route for handle expired passwords
439502
def devise_displayqr(mapping, controllers)
      resource :displayqr, :only => [:show, :update], :path => mapping.path_names[:displayqr], :controller => controllers[:displayqr] do
      	post :refresh, :path => mapping.path_names[:refresh], :as => :refresh
      end
      resource :checkga, :only => [:show, :update], :path => mapping.path_names[:checkga], :controller => controllers[:checkga]
    end
373021
def forgot_password():
    """"""

    form_class = _security.forgot_password_form

    if request.is_json:
        form = form_class(MultiDict(request.get_json()))
    else:
        form = form_class()

    if form.validate_on_submit():
        send_reset_password_instructions(form.user)
        if not request.is_json:
            do_flash(*get_message('PASSWORD_RESET_REQUEST',
                     email=form.user.email))

    if request.is_json:
        return _render_json(form, include_user=False)

    return _security.render_template(config_value('FORGOT_PASSWORD_TEMPLATE'),
                                     forgot_password_form=form,
                                     **_ctx('forgot_password'))
860786
def _selftoken_expired():
    '''
    
    '''
    try:
        verify = __opts__['vault'].get('verify', None)
        url = '{0}/v1/auth/token/lookup-self'.format(__opts__['vault']['url'])
        if 'token' not in __opts__['vault']['auth']:
            return True
        headers = {'X-Vault-Token': __opts__['vault']['auth']['token']}
        response = requests.get(url, headers=headers, verify=verify)
        if response.status_code != 200:
            return True
        return False
    except Exception as e:
        raise salt.exceptions.CommandExecutionError(
            'Error while looking up self token : {0}'.format(six.text_type(e))
            )
1064901
function password_handler()
    {
        $keyid  = rcube_utils::get_input_value('_keyid', rcube_utils::INPUT_POST);
        $passwd = rcube_utils::get_input_value('_passwd', rcube_utils::INPUT_POST, true);

        if ($keyid && $passwd !== null && strlen($passwd)) {
            $this->save_password(strtoupper($keyid), $passwd);
        }
    }
332366
public function resetpasswordAction() {
        $this->view->title = __('reset password page title');
        $authVars = Garp_Auth::getInstance()->getConfigValues();
        $activationCode = $this->getRequest()->getParam('c');
        $activationEmail = $this->getRequest()->getParam('e');
        $expirationColumn = $authVars['forgotpassword']['activation_code_expiration_date_column'];

        $userModel = new Model_User();
        $activationCodeClause = 'MD5(CONCAT(' .
                $userModel->getAdapter()->quoteIdentifier(
                    $authVars['forgotpassword']['activation_token_column']
                ) . ',' .
                'MD5(email),' .
                'MD5(' . $userModel->getAdapter()->quote($authVars['salt']) . '),' .
                'MD5(id)' .
            ')) = ?'
        ;
        $select = $userModel->select()
            // check if a user matches up to the given code
            ->where($activationCodeClause, $activationCode)
            // check if the given email address is part of the same user record
            ->where('MD5(email) = ?', $activationEmail);

        $user = $userModel->fetchRow($select);
        if (!$user) {
            $this->view->error = __('reset password user not found');
            return;
        }
        if (strtotime($user->{$expirationColumn}) < time()) {
            $this->view->error = __('reset password link expired');
            return;
        }
        if (!$this->getRequest()->isPost()) {
            return;
        }
        $password = $this->getRequest()->getPost('password');
        if (!$password) {
            $this->view->formError = sprintf(__('%s is a required field'), ucfirst(__('password')));
            return;
        }

        if (!empty($authVars['forgotpassword']['repeatPassword'])
            && !empty($authVars['forgotpassword']['repeatPasswordField'])
        ) {
            $repeatPasswordField = $this->getRequest()->getPost(
                $authVars['forgotpassword']['repeatPasswordField']
            );
            if ($password != $repeatPasswordField) {
                $this->view->formError = __('the passwords do not match');
                return;
            }
        }

        // Update the user's password and send him along to the login page
        $updateClause = $userModel->getAdapter()->quoteInto('id = ?', $user->id);
        $userModel->update(
            array(
            'password' => $password,
            $authVars['forgotpassword']['activation_token_column'] => null,
            $authVars['forgotpassword']['activation_code_expiration_date_column'] => null
            ), $updateClause
        );
        $this->_helper->flashMessenger(__($authVars['resetpassword']['success_message']));
        $this->_redirect('/g/auth/login');
    }
109522
function passwd(oldPassword, newPassword, callback) {
    if (!deis._authenticated) {
      return callback(new Error('You need to login first'));
    }

    deis.client.post(format('/%s/auth/passwd', deis.version), {
      password: oldPassword,
      new_password: newPassword
    }, function(err, res, body) {
      if (err) {
        return callback(err);
      }

      if (res.statusCode === 200) {
        return callback(null);
      }

      return callback(new Error('Password change failed: ' + body.detail));
    });
  }
729337
def expiring_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)
      temp_url(object_key, temp_url_key, expires_at)
    end
803069
public function handleExpired()
    {
        $expired = $this->clients->getExpired(AlphaRPC::CLIENT_PING);
        foreach ($expired as $client) {
            $this->reply($client, new TimeoutResponse());
        }
    }
1105742
def password_too_old?
      return false if new_record?
      return false unless password_expiration_enabled?
      return false if expire_password_on_demand?

      password_changed_at < expire_password_after.seconds.ago
    end
930836
def auth_expired(self):
        
        if self._auth and self._expires:
            now_with_skew = time.time() + AUTH_TOKEN_CLOCK_SKEW_MAX
            return now_with_skew > self._expires
        return True
79837
def clean_expired_user_attempts(attempt_time: datetime = None) -> int:
    

    if settings.AXES_COOLOFF_TIME is None:
        log.debug('AXES: Skipping clean for expired access attempts because no AXES_COOLOFF_TIME is configured')
        return 0

    threshold = get_cool_off_threshold(attempt_time)
    count, _ = AccessAttempt.objects.filter(attempt_time__lt=threshold).delete()
    log.info('AXES: Cleaned up %s expired access attempts from database that were older than %s', count, threshold)
    return count
1161888
function(req, options) {
  var username;
  var password;
  var ldap;
  var errorHandler;
  options || (options = {}); // eslint-disable-line no-param-reassign

  if (typeof this.options.credentialsLookup === 'function') {
    var credentials = this.options.credentialsLookup(req);
    if (credentials != null) {
      // name and pass as a courtesy for those who use basic-auth directly as
      // they're likely the main user group.
      username = credentials.username || credentials.name;
      password = credentials.password || credentials.pass;
    }
  } else {
    username = lookup(req.body, this.options.usernameField) || lookup(req.query, this.options.usernameField);
    password = lookup(req.body, this.options.passwordField) || lookup(req.query, this.options.passwordField);
  }

  if (!username || !password) {
    return this.fail({ message: options.badRequestMessage || 'Missing credentials' }, this.options.missingCredentialsStatus || 400);
  }

  errorHandler = this.options.handleErrorsAsFailures === true ? handleErrorAsFailure.bind(this) : this.error.bind(this);

  /**
   * AD possible messages
   * http://www-01.ibm.com/support/docview.wss?uid=swg21290631
   */
  var messages = {
    '530': options.invalidLogonHours || 'Not Permitted to login at this time',
    '531': options.invalidWorkstation || 'Not permited to logon at this workstation',
    '532': options.passwordExpired || 'Password expired',
    '533': options.accountDisabled || 'Account disabled',
    '534': options.accountDisabled || 'Account disabled',
    '701': options.accountExpired || 'Account expired',
    '773': options.passwordMustChange || 'User must reset password',
    '775': options.accountLockedOut || 'User account locked',
    default: options.invalidCredentials || 'Invalid username/password'
  };

  ldap = new LdapAuth(this.options.server);
  ldap.once('error', errorHandler);
  ldap.on('error', function() { /* Ignored */ });
  ldap.authenticate(username, password, function(err, user) {
    ldap.close(function(){
      // We don't care about the closing
    });

    if (err) {
      // Invalid credentials / user not found are not errors but login failures
      if (err.name === 'InvalidCredentialsError' || err.name === 'NoSuchObjectError' || (typeof err === 'string' && err.match(/no such user/i))) {
        var message;
        if (err.name === 'NoSuchObjectError') {
          message = options.noSuchObject || 'Bad search base';
        } else {
          message = options.invalidCredentials || 'Invalid username/password';
        }

        if (err.message) {
          var ldapComment = err.message.match(/data ([0-9a-fA-F]*), v[0-9a-fA-F]*/);
          if (ldapComment && ldapComment[1]){
            message = messages[ldapComment[1]] || messages['default'];
          }
        }
        return this.fail({ message: message }, 401);
      }
      if (err.name === 'ConstraintViolationError'){
        return this.fail({ message: options.constraintViolation || 'Exceeded password retry limit, account locked' }, 401);
      }

      // Other errors are (most likely) real errors
      return errorHandler(err);
    }

    if (!user) {
      return this.fail({ message: options.userNotFound || 'Invalid username/password' }, 401);
    }

    // Execute given verify function
    if (this.verify) {
      if (this.options.passReqToCallback) {
        return this.verify(req, user, verify.call(this));
      } else {
        return this.verify(user, verify.call(this));
      }
    } else {
      return this.success(user);
    }
  }.bind(this));
}
221441
public function postForgotPassword()
    {
        // Declare the rules for the validator
        $rules = array(
            'email' => 'required|email',
        );

        // Create a new validator instance from our dynamic rules
        $validator = Validator::make(Input::all(), $rules);

        // If validation fails, we'll exit the operation now.
        if ($validator->fails()) {
            // Ooops.. something went wrong
            return Redirect::to(URL::previous())->withInput()->withErrors($validator);
        }

        // Get the user password recovery code
        $user = Sentinel::findByCredentials(['email' => Input::get('email')]);

        if($user)
        {
            //get reminder for user
            $reminder = Reminder::exists($user) ?: Reminder::create($user);

            // Data to be used on the email view
            $data = array(
                'user'              => $user,
                'forgotPasswordUrl' => URL::route('forgot-password-confirm',[$user->id, $reminder->code]),
            );

            Base::Log('Forgot password request for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() );

            // Send the activation code through email
            Mail::queue('emails.auth.forgot-password', $data, function ($m) use ($user) {
                $m->to($user->email, $user->first_name . ' ' . $user->last_name);
                $m->subject(Lang::get('base.mails.recovery'));
            });
        }

        //  Redirect to the forgot password
        return Redirect::to(URL::previous())->with('success', Lang::get('base.auth.forgot_password.success'));
    }
306568
def reset_password(token):
    """"""

    expired, invalid, user = reset_password_token_status(token)

    if not user or invalid:
        invalid = True
        do_flash(*get_message('INVALID_RESET_PASSWORD_TOKEN'))

    if expired:
        send_reset_password_instructions(user)
        do_flash(*get_message('PASSWORD_RESET_EXPIRED', email=user.email,
                              within=_security.reset_password_within))
    if invalid or expired:
        return redirect(url_for('forgot_password'))

    form = _security.reset_password_form()

    if form.validate_on_submit():
        after_this_request(_commit)
        update_password(user, form.password.data)
        do_flash(*get_message('PASSWORD_RESET'))
        return redirect(get_url(_security.post_reset_view) or
                        get_url(_security.login_url))

    return _security.render_template(
        config_value('RESET_PASSWORD_TEMPLATE'),
        reset_password_form=form,
        reset_password_token=token,
        **_ctx('reset_password')
    )
856011
def expirePassword(self,
                       hours="now"):
        """"""

        params = {
            "f" : "json"
        }
        expiration = -1
        if isinstance(hours, str):
            if expiration == "now":
                expiration = -1
            elif expiration == "never":
                expiration = 0
            else:
                expiration = -1
        elif isinstance(expiration, (int, long)):
            dt = datetime.now() + timedelta(hours=hours)
            expiration = local_time_to_online(dt=dt)
        else:
            expiration = -1
        params['expiration'] = expiration
        url = "%s/expirePassword" % self.root
        return self._post(url=url,
                             param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
247876
def format(self, password: str = '') -> str:
        """"""
        return MARKER_START + \
            self.name + \
            self.action + \
            self.args + \
            password + \
            MARKER_END
169858
def _allow_custom_expire(self, load):
        '''
        
        '''
        expire_override = self.opts.get('token_expire_user_override', False)

        if expire_override is True:
            return True

        if isinstance(expire_override, collections.Mapping):
            expire_whitelist = expire_override.get(load['eauth'], [])
            if isinstance(expire_whitelist, collections.Iterable):
                if load.get('username') in expire_whitelist:
                    return True

        return False