Register a service with the accounts service

    \b
    EMAIL: a user's email
    PASSWORD: a user's password
    ORGANISATION_ID: ID of the service's parent organisation
510872
def register_service(email, password, organisation_id, name=None,
                     service_type=None, accounts_url=None,
                     location=None, config=None):
    
    accounts_url = accounts_url or getattr(options, 'url_accounts', None)
    name = name or getattr(options, 'name', None)
    service_type = service_type or getattr(options, 'service_type', None)
    location = location or ('https://localhost:' + str(getattr(options, 'port')))
    config = config or 'config'

    if not accounts_url:
        raise click.ClickException(click.style('accounts_url not defined',
                                               fg='red'))

    if not name:
        raise click.ClickException(click.style('service name not defined',
                                               fg='red'))

    if not service_type:
        raise click.ClickException(click.style('service type not defined',
                                               fg='red'))

    try:
        client = _get_accounts_client(accounts_url, email, password)
        service_id = _create_service(client, organisation_id, name, location, service_type)
        client_secret = _get_client_secret(client, service_id)
        _update_local_conf(config, service_id, client_secret)
    except httpclient.HTTPError as exc:
        try:
            msg = exc.response.body
        except AttributeError:
            msg = exc.message
        raise click.ClickException(click.style(msg, fg='red'))
    except socket.error as exc:
        raise click.ClickException(click.style(exc.strerror, fg='red'))

    click.echo(click.style('\n{} service registered\n'.format(name),
                           fg='green'))
1193287
def _get_password(params):
        
        user_name = params['user']
        service_name = params['host'] + ':' + params['driver']
        return keyring.get_password(service_name=service_name,
                                    username=user_name)
7375
def register_with_password(self, username, password):
        
        response = self.api.register(
                auth_body={"type": "m.login.dummy"},
                kind='user',
                username=username,
                password=password,
        )
        return self._post_registration(response)
407085
function (form) {
            var data = {
              email: form.data.email
            };

            if (req.organization) {
              data.accountStore = {
                href: req.organization.href
              };
            }

            application.sendPasswordResetEmail(data, function (err) {
              if (err) {
                logger.info('A user tried to reset their password, but supplied an invalid email address: ' + form.data.email + '.');
              }

              res.redirect(config.web.forgotPassword.nextUri);
            });
          }
580180
def account(self):
        
        data = self.query(Account.key)
        return Account(self, data)
851594
def create(email, password):
    
    with get_app().app_context():
        user = User(email=email, password=password)
        result = user_service.save(user)
        if not isinstance(result, User):
            print_validation_errors(result)
            return

        click.echo(green('\nUser created:'))
        click.echo(green('-' * 40))
        click.echo(str(user) + '\n')
826772
def get_password(self, service, username):
        
        init_part = self._keyring.get_password(service, username)
        if init_part:
            parts = [init_part]
            i = 1
            while True:
                next_part = self._keyring.get_password(
                    service,
                    '%s{{part_%d}}' % (username, i))
                if next_part:
                    parts.append(next_part)
                    i += 1
                else:
                    break
            return ''.join(parts)
        return None
1184295
def register_account(self, username, service):
        
        data = {
            'service': service,
            'username': username,
        }

        return self._perform_post_request(self.register_account_endpoint, data, self.token_header)
424433
def login(email, password, opts = {})
      ensure_ready!
      opts = opts.merge(:email => email, :password => password)
      checked_response_body(connection.post('login', opts))
    end
359094
def get_password(self, service, username):
        
        items = self._find_passwords(service, username)
        if not items:
            return None

        secret = items[0].secret
        return (
            secret
            if isinstance(secret, six.text_type) else
            secret.decode('utf-8')
        )
117563
def register(request,
             email_template='locksmith/registration_email.txt',
             registration_template=getattr(settings, 'LOCKSMITH_REGISTER_TEMPLATE', 'locksmith/register.html'),
             registered_template=getattr(settings, 'LOCKSMITH_REGISTERED_TEMPLATE', 'locksmith/registered.html'),
            ):
    '''
        
    '''
    if request.method == 'POST':
        form = KeyForm(request.POST)
        if form.is_valid():
            newkey = form.save(commit=False)
            newkey.key = uuid.uuid4().hex
            newkey.status = 'U'
            newkey.save()

            send_key_email(newkey, email_template)
            return render_to_response(registered_template, {'key': newkey, 'LOCKSMITH_BASE_TEMPLATE': settings.LOCKSMITH_BASE_TEMPLATE }, context_instance=RequestContext(request))
    else:
        form = KeyForm()
    return render_to_response(registration_template, {'form':form, 'LOCKSMITH_BASE_TEMPLATE': settings.LOCKSMITH_BASE_TEMPLATE}, context_instance=RequestContext(request))
339287
def auth_add(name, service, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:members:add', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'service': service,
    })
625552
def authenticate(self, transport, account_name, password=None):
        
        Authenticator.authenticate(self, transport, account_name, password)

        if password == None:
            return self.pre_auth(transport, account_name)
        else:
            return self.auth(transport, account_name, password)
1069746
def create_user(backend, details, response, uid, username, user=None, *args, **kwargs):
    
    if user:
        return {'user': user}
    if not username:
        return None
    email = details.get('email')
    original_email = None
    # email is required
    if not email:
        message = _("""your social account needs to have a verified email address in order to proceed.""")
        raise AuthFailed(backend, message)
    # Avoid hitting field max length
    if email and len(email) > 75:
        original_email = email
        email = ''
    return {
        'user': UserSocialAuth.create_user(username=username,
                                           email=email,
                                           sync_emailaddress=False),
        'original_email': original_email,
        'is_new': True
    }
1246326
def users_register(self, email, name, password, username, **kwargs):
        """"""
        return self.__call_api_post('users.register', email=email, name=name, password=password, username=username,
                                    kwargs=kwargs)
643642
def auth(self):
        
        if self._auth is None:
            self._auth = AuthTypesList(
                self._version,
                account_sid=self._solution['account_sid'],
                domain_sid=self._solution['sid'],
            )
        return self._auth
371070
def login_from_basic_auth
      authenticate_with_http_basic do |accountname, password|
        account = Account.authenticate(accountname, password, true)
        self.auth_type_used = :basic if not account.nil?
        self.current_account = account
        account
      end
    end