Initialize password recovery form

@access public
@author Aleh Hutnikau <hutnikau@1pt.com>
3214
public function initForm()
    {
        $this->form = tao_helpers_form_FormFactory::getForm('passwordRecoveryForm');

        $connectElt = tao_helpers_form_FormFactory::getElement('recovery', 'Submit');
        $connectElt->setValue(__('Email'));
        $connectElt->setAttribute('class', 'btn-success small');
        $this->form->setActions(array($connectElt), 'bottom');
    }
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);
        }
    }
763559
private static function init() {
			self::$_ownerName          = function_exists( 'get_current_user' ) ?
				get_current_user() :
				'unknown';
			self::$_isStorageLoggingOn = ( 1 == get_option( 'fs_storage_logger', 0 ) );
			self::$_abspathLength      = strlen( ABSPATH );
			self::$_processID          = mt_rand( 0, 32000 );

			// Process ID may be `false` on errors.
			if ( ! is_numeric( self::$_processID ) ) {
				self::$_processID = 0;
			}
		}
913590
public function initElements()
    {
    	if (isset($this->data['redirect']) && !empty($this->data['redirect'])) {
			$hiddenElt = tao_helpers_form_FormFactory::getElement('redirect', 'Hidden');
			$hiddenElt->setValue($this->data['redirect']);
			$this->form->addElement($hiddenElt);
    	}
    	$loginElt = tao_helpers_form_FormFactory::getElement('login', 'Textbox');
		$loginElt->setDescription(Layout::getLoginLabel());
		$loginElt->setAttributes(array('autofocus' => 'autofocus'));
		$loginElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
		$this->form->addElement($loginElt);

		$passwordWidgetId = (isset($this->data['enablePasswordReveal']) && !empty($this->data['enablePasswordReveal']))
            ? 'ViewableHiddenbox'
            : 'Hiddenbox';
		$passElt = tao_helpers_form_FormFactory::getElement('password', $passwordWidgetId);
		$passElt->setDescription(Layout::getPasswordLabel());
		$passElt->addValidator(
			tao_helpers_form_FormFactory::getValidator('NotEmpty')
		);
		$this->form->addElement($passElt);

		if (isset($this->data['disableAutocomplete']) && !empty($this->data['disableAutocomplete'])) {
			$loginElt->setAttributes(array('autofocus' => 'autofocus', 'autocomplete' => 'off'));
			$passElt->setAttributes(array('autocomplete' => 'off'));
		}
    }
1016215
protected function _init()
    {
        if (!isset($this->_ob) ||
            ($this->_ob->md5 != hash('md5', $this->key))) {
            switch ($this->cipher) {
            case 'cbc':
                $this->_ob = new Horde_Crypt_Blowfish_Php_Cbc($this->key);
                break;

            case 'ecb':
                $this->_ob = new Horde_Crypt_Blowfish_Php_Ecb($this->key);
                break;
            }
        }
    }
1354690
public function recover() : Response
    {
        //if the user submited the form and passes the security check then we start checking
        $email = $this->request->getPost('email', 'email');

        $validation = new Validation();
        $validation->add('email', new PresenceOf(['message' => _('The email is required.')]));
        $validation->add('email', new EmailValidator(['message' => _('The email is invalid.')]));

        $messages = $validation->validate($this->request->getPost());
        if (count($messages)) {
            foreach ($messages as $message) {
                throw new Exception($message);
            }
        }

        /**
         * check if the user email exist
         * if it does creat the user activation key to send
         * send the user email
         *
         * if it doesnt existe then send the erro msg
         */
        if ($recoverUser = Users::getByEmail($email)) {
            $recoverUser->user_activation_forgot = $recoverUser->generateActivationKey();
            $recoverUser->update();

            $message = _('Please check your email inbox to complete the password recovery.');
            $this->sendEmail($recoverUser, 'recover');
        } else {
            $message = _('There is no account registered with that email.');
        }

        return $this->response($message);
    }
861900
public function resetPassword()
    {
        $user = $this->_user;
        $user->password = $this->password;
        $user->removePasswordResetToken();

        return $user->save();
    }
1166067
private function initialize()
    {
        // get parameters
        $params = $this->getParameters();

        foreach ($params as $param) {
            $paramName = $param->getName();
            if (self::$REVERSE_KEY === $paramName) {
                $this->setReverse(StringHelper::booleanValue($param->getValue()));
                continue;
            }
        }
    }
1054612
public function resetPassword()
    {
        $user = $this->user;
        $user->setPassword($this->password);
        $user->removePasswordResetToken();

        return $user->save();
    }
345587
private function _initialize()
    {
        if ($this->getInitialized()) {
            return;
        }

        $params = $this->getParameters();
        if ($params !== null) {
            foreach ($params as $param) {
                if ('in' == $param->getName()) {
                    $this->setInputEncoding($param->getValue());
                } else {
                    if ('out' == $param->getName()) {
                        $this->setOutputEncoding($param->getValue());
                    }
                }
            }
        }

        $this->setInitialized(true);
    }
393108
public function postReset()
    {
        $credentials = Input::only(
            'email', 'password', 'password_confirmation', 'token'
        );

        $response = Password::reset($credentials, function($user, $password)
        {
            $user->password = Hash::make($password);
            $user->save();
        });

        switch ($response)
        {
            case Password::INVALID_PASSWORD:
            case Password::INVALID_TOKEN:
            case Password::INVALID_USER:
                return Redirect::back()->with('error', 'Something was wrong with the input you provided.');

            case Password::PASSWORD_RESET:
                return Redirect::route('bumble.login');
        }
    }
1360258
public function init() {
        //If available load the config from the security file, else create a new array
        if ($this->securityFile) {
            if (!$this->loadSecurityConfiguration()) {
                $this->config = array();
            }
        } else {
            $this->config = array();
        }
        //Set ready to true
        $this->ready = true;
    }
212345
protected function Init()
    {
        $this->confirm = ContentChangePasswordConfirm::Schema()->ByContent($this->Content());
        $this->confirmer = new Confirmer(ChangeRequestPurpose::NewPassword());
        $this->isValid = $this->confirmer->Check(Request::GetArray());
        if (!$this->isValid && $this->confirm->GetErrorUrl()) {
            Response::Redirect(FrontendRouter::Url($this->confirm->GetErrorUrl()));
            return true;
        }
        $this->AddPasswordField();
        $this->AddPasswordRepeatField();
        $this->AddUniqueSubmit('PasswordChangeSubmit');
        return parent::Init();
    }
879525
public function main()
    {
        if (empty($this->args[0])) {
            $this->err('Please provide a password string.', 2);

            return false;
        }

        $hasher = new DefaultPasswordHasher;
        $passwordToHash = $this->args[0];
        $hashedPassword = $hasher->hash($passwordToHash);

        $this->out('Your password: ' . $hashedPassword, 2);

        return true;
    }
447088
private function initSession()
    {
        $transport = $this->transportRegistry->getTransport($this->profile->get('transport', 'name'));
        $repository = $transport->getRepository($this->profile->get('transport'));

        $credentials = new SimpleCredentials(
            $this->profile->get('phpcr', 'username'),
            $this->profile->get('phpcr', 'password')
        );

        $session = $repository->login($credentials, $this->profile->get('phpcr', 'workspace'));

        // if you are wondering wtf here -- we wrap the PhpcrSession
        if (!$this->session) {
            $this->session = new PhpcrSession($session);
        } else {
            $this->session->setPhpcrSession($session);
        }
    }
207600
public function init()
    {
        parent::init();

        // Check we are logged in as a user who can access front end management
        if (!Permission::check("USERS_MANAGE_ACCOUNT")) {
            Security::permissionFailure();
        }

        // Set our member object
        $member = Member::currentUser();

        if ($member instanceof Member) {
            $this->member = $member;
        }
    }
1228433
public function session_init()
    {
        parent::session_init();

        // set initial session vars
        if (!$_SESSION['user_id']) {
            $_SESSION['temp'] = true;
        }

        // restore skin selection after logout
        if ($_SESSION['temp'] && !empty($_SESSION['skin'])) {
            $this->config->set('skin', $_SESSION['skin']);
        }
    }