Password signup handler
325317
function createUser (req, res, next) {
    User.insert(req.body, { private: true }, function (err, user) {
      if (err) {
        res.render('signup', {
          params: qs.stringify(req.body),
          request: req.body,
          providers: settings.providers,
          error: err.message
        })
      } else {
        authenticator.dispatch('password', req, res, next, function (err, user, info) {
          if (err) { return next(err) }
          if (!user) {
          } else {
            authenticator.login(req, user)
            req.sendVerificationEmail =
              req.provider.emailVerification.enable
            req.flash('isNewUser', true)
            next()
          }
        })
      }
    })
  }
28217
def _handle_login(self, event):
        """"""

        # TODO: Refactor to simplify

        self.log("Auth request for ", event.username, 'client:',
                 event.clientuuid)

        # TODO: Define the requirements for secure passwords etc.
        # They're also required in the Enrol module..!

        if (len(event.username) < 1) or (len(event.password) < 5):
            self.log("Illegal username or password received, login cancelled", lvl=warn)
            self._fail(event, 'Password or username too short')
            return

        client_config = None

        try:
            user_account = objectmodels['user'].find_one({
                'name': event.username
            })
            # self.log("Account: %s" % user_account._fields, lvl=debug)
            if user_account is None:
                raise AuthenticationError
        except Exception as e:
            self.log("No userobject due to error: ", e, type(e),
                     lvl=error)
            self._fail(event)
            return

        self.log("User found.", lvl=debug)

        if user_account.active is False:
            self.log("Account deactivated.")
            self._fail(event, 'Account deactivated.')
            return

        if not std_hash(event.password, self.salt) == user_account.passhash:
            self.log("Password was wrong!", lvl=warn)
            self._fail(event)
            return

        self.log("Passhash matches, checking client and profile.",
                 lvl=debug)

        requested_client_uuid = event.requestedclientuuid
        if requested_client_uuid is not None:
            client_config = objectmodels['client'].find_one({
                'uuid': requested_client_uuid
            })

        if client_config:
            self.log("Checking client configuration permissions",
                     lvl=debug)
            # TODO: Shareable client configurations?
            if client_config.owner != user_account.uuid:
                client_config = None
                self.log("Unauthorized client configuration "
                         "requested",
                         lvl=warn)
        else:
            self.log("Unknown client configuration requested: ",
                     requested_client_uuid, event.__dict__,
                     lvl=warn)

        if not client_config:
            self.log("Creating new default client configuration")
            # Either no configuration was found or not requested
            # -> Create a new client configuration
            uuid = event.clientuuid if event.clientuuid is not None else str(uuid4())

            client_config = objectmodels['client']({'uuid': uuid})

            client_config.name = std_human_uid(kind='place')

            client_config.description = "New client configuration from " + user_account.name
            client_config.owner = user_account.uuid

            # TODO: Get client configuration storage done right, this one is too simple
            client_config.save()

        user_profile = self._get_profile(user_account)

        self._login(event, user_account, user_profile, client_config)
        self.log("Done with Login request", lvl=debug)
435843
def register(self, password):
        """"""

        if len(password) < 8:
            raise ValueError("Password must be at least 8 characters.")

        params = {"name": self.nick, "password": password}
        resp = self.conn.make_api_call("register", params)

        if "error" in resp:
            raise RuntimeError(f"{resp['error'].get('message') or resp['error']}")

        self.conn.make_call("useSession", resp["session"])
        self.conn.cookies.update({"session": resp["session"]})
        self.logged_in = True
1294839
function(request, username, password, callback) {
    const user = users[username];
    if (!user) {
        return callback(null, false);
    }
    const isValid = password === user.password;
    callback(null, isValid, { id: user.id, name: user.name });
}
579530
def login(self, user, passwd):
        ''''''
        resp = self.post('token', json={'username': user, 'password': passwd})
        self._token = resp.json()['response']['token']
203003
function onSendPasswordResetEmail() {
  var email = $('#password-reset-email').val();
  auth.sendPasswordResetEmail(email, getActionCodeSettings()).then(function() {
    alertSuccess('Email sent!');
  }, onAuthError);
}
413995
public void handleEvent(Event event) {
        LOG.fine("PasswordHandler called");

        if (tagnames==null || tagnames.size() == 0) {
            LOG.warning("Password filter is active but there is no filter tagname configured!");
        }

        if (tagnames != null && event.getContent() != null
                && event.getContent().length() > 0) {
            LOG.fine("Content before: " + event.getContent());
            for (String tagname : tagnames) {
                event.setContent(event.getContent().replaceAll(
                        "<([^>]*)" + tagname
                                + "([^>]*)>([^<]*)<([^>]*)/([^>]*)" + tagname
                                + "([^>]*)>", REPLACE));
                event.setContent(event.getContent().replaceAll(
                        "<([^>]*)" + tagname + "([^>]*)/([^>]*)>",
                        REPLACE));

            }
            LOG.fine("Content after: " + event.getContent());
        }
    }
230931
def init(base_url, username=None, password=None, verify=True):
    """"""
    handler = RequestHandler(base_url, username, password, verify)
    set_default_request_handler(handler)
    return handler
1251017
def acquire_password(args)
      if args[:pw] == :prompt
        JSS.prompt_for_password "Enter the password for JSS user #{args[:user]}@#{args[:server]}:"
      elsif args[:pw].is_a?(Symbol) && args[:pw].to_s.start_with?('stdin')
        args[:pw].to_s =~ /^stdin(\d+)$/
        line = Regexp.last_match(1)
        line ||= 1
        JSS.stdin line
      else
        args[:pw]
      end
    end
677217
def cli(obj, name, email, password, status, text):
    """"""
    client = obj['client']
    if not email:
        raise click.UsageError('Need "--email" to sign-up new user.')
    if not password:
        raise click.UsageError('Need "--password" to sign-up new user.')
    try:
        r = client.signup(name=name, email=email, password=password, status=status, attributes=None, text=text)
    except Exception as e:
        click.echo('ERROR: {}'.format(e))
        sys.exit(1)
    if 'token' in r:
        click.echo('Signed Up.')
    else:
        raise AuthError
1011843
def rootChild_resetPassword(self, req, webViewer):
        
        from xmantissa.signup import PasswordResetResource
        return PasswordResetResource(self.store)
1340891
void submit() {

        String password1 = m_form.getPassword1();
        String password2 = m_form.getPassword2();

        if (validatePasswords(password1, password2)) {
            String oldPassword = m_form.getOldPassword();
            boolean error = false;

            if (oldPassword.equals(password1)) {
                m_form.setErrorPassword1(
                    new UserError(
                        Messages.get().getBundle(m_locale).key(Messages.GUI_PWCHANGE_DIFFERENT_PASSWORD_REQUIRED_0)),
                    OpenCmsTheme.SECURITY_INVALID);
                error = true;
            } else {
                try {
                    m_cms.setPassword(m_user.getName(), oldPassword, password1);
                } catch (CmsException e) {
                    m_form.setErrorOldPassword(
                        new UserError(e.getLocalizedMessage(m_locale)),
                        OpenCmsTheme.SECURITY_INVALID);
                    error = true;
                    LOG.debug(e.getLocalizedMessage(), e);
                }
            }

            if (!error) {
                if (m_context != null) {
                    close();
                } else {
                    // this will be the case for forced password changes after login
                    CmsVaadinUtils.showAlert(
                        Messages.get().getBundle(m_locale).key(Messages.GUI_PWCHANGE_SUCCESS_HEADER_0),
                        Messages.get().getBundle(m_locale).key(Messages.GUI_PWCHANGE_GUI_PWCHANGE_SUCCESS_CONTENT_0),
                        new Runnable() {

                            public void run() {

                                A_CmsUI.get().getPage().setLocation(
                                    OpenCms.getLinkManager().substituteLinkForUnknownTarget(
                                        CmsLoginUI.m_adminCms,
                                        CmsWorkplaceLoginHandler.LOGIN_HANDLER
                                            + "?ocUname="
                                            + m_user.getSimpleName()
                                            + "&ocOuFqn="
                                            + m_user.getOuFqn(),
                                        false));
                            }

                        });
                }
            }
        }
    }
210166
def password_prompt(ctx, param, value):
    """"""
    if ctx.resilient_parsing:
        return

    if not value:
        if 'password_stdin' in ctx.params:
            with click.open_file('-') as fp:
                value = fp.read().strip('\n')
        else:
            value = click.prompt('Password', hide_input=True)

    click.echo(value)
    return value
1133246
def login_handler(self, config=None, prefix=None, **args):
        """"""
        params = {
            'response_type': 'code',
            'client_id': self.google_api_client_id,
            'redirect_uri': self.scheme_host_port_prefix(
                'http', config.host, config.port, prefix) + '/home',
            'scope': self.google_api_scope,
            'state': self.request_args_get('next', default=''),
        }
        url = self.google_oauth2_url + 'auth?' + urlencode(params)
        return self.login_handler_redirect(url)
1329060
function login(type) {
	
	var input = getInput();
	
	var onDone = function (err, result) {
		if (err) {
			console.error(err);
			// switch for various errors
			switch (err) {				
				case 'ACCOUNT_EXISTS':
					alert(l_lang.err_exists);
					break;
				case 'INVALID_EMAIL':
					alert(l_lang.err_email);
					break;		
				case 'INVALID_ACCOUNT':
				case 'INVALID_PASSWORD_OR_TOKEN':
					alert(l_lang.err_notfound);
					break;					
				case 'INVALID_DATA':
				case 'UID_ERROR':
				case 'DB_ERROR':
				case 'GROUP_ERROR':
				default:
					alert(err);
					break;
			}
			return;
		}

		// do not redirect if it's just to reset password or register
		if (type === 'getpass')
			return;
		
		// try to login if register success
		if (type === 'register') {
			alert(l_lang.register_success);
			login('account');
			return;
		}
		
		alert(l_lang.login_success);
		window.location = '/main';		
	}
	
	switch (type) {
		case 'register':
			if (input.account === '' || input.password === '' || input.email === '') {
				return alert(l_lang.err_incomplete);	
			}
			SR.API._ACCOUNT_REGISTER(input, onDone);
			break;
		case 'account':
			console.log('calling _ACCOUNT_LOGIN');
			SR.API._ACCOUNT_LOGIN(input, onDone);
			break;
		case 'getpass':
			SR.API._ACCOUNT_RESETPASS(input, onDone);
			break;
		default:
			alert('unknown login type');
			break;
	}
}
1153053
function(username, password, callback) {

            var args = Array.prototype.slice.call(arguments);

            if (args.length === 1) {
                callback = arguments[0];
            } else {
                this.set({
                    username: username,
                    password: password
                });
            }

            this.validateAndSave(null, function(err, session) {
                if (!err && session) {
                    session.set("password", null);

                    session.fetch({
                        fetchSubModels: ["user"]
                    }, callback);
                } else {
                    callback(err);
                }
            });
        }
904637
function handleLogin(user, req, res, next) {


    var token;
    var profile;
    var tokenExpiresInMinutes;
    var envelope = {
      data: user,
      isAuthenticated: true,
      meta: {}
    };

    // First handle the case where the user was not logged in.
    if (!user) {
      if (authConfig.maintenance === 'cookie') {
        req.logout();
      }
      return res.status(401).send('Wrong password or no such user.');
    }
    // user_id is how it is in the schema
    /* jshint ignore:start */
    // Now handle the case where we did get a user record.
    if (authConfig.maintenance === 'token') {
      // For token authentication we want to add a token.
      profile = {
        username: user.username,
        email: user.email,
        userdata_id: user.userdata_id
      };
      /* jshint ignore:end */
      tokenExpiresInMinutes = authConfig.expiresInMinutes || 60;
      envelope.meta.token = generateToken(profile, tokenExpiresInMinutes,
        secrets.authTokenSecret);

      envelope.meta.expires = getExpirationTime(tokenExpiresInMinutes);
      return res.status(200).send(envelope);
    } else if (authConfig.maintenance === 'cookie') {
      // For cookie authentication we want to login the user.
      req.login(user, function (err) {
        if (err) {
          return next(err);
        } else {
          return res.status(200).send(envelope);
        }
      });
    }
  }