Sends an email with a link, for resetting the password.

@return boolean whether the email was send
549152
public function sendEmail()
    {
        /* @var $user \common\models\User */
        $identityClassName = \Yii::$app->user->identityClass;

        $user = $identityClassName::findByUsernameOrEmail($this->identifier);
        //$user = $identityClassName::

        if ($user) {
            if (!$identityClassName::isPasswordResetTokenValid($user->password_reset_token)) {
                $user->generatePasswordResetToken();
            }

            if ($user->save()) {
                if (!$user->email) {
                    return false;
                }

                if ($this->isAdmin) {
                    $resetLink = \skeeks\cms\helpers\UrlHelper::construct('admin/auth/reset-password',
                        ['token' => $user->password_reset_token])->enableAbsolute()->enableAdmin();
                } else {
                    $resetLink = \skeeks\cms\helpers\UrlHelper::construct('cms/auth/reset-password',
                        ['token' => $user->password_reset_token])->enableAbsolute();
                }


                \Yii::$app->mailer->view->theme->pathMap = ArrayHelper::merge(\Yii::$app->mailer->view->theme->pathMap,
                    [
                        '@app/mail' =>
                            [
                                '@skeeks/cms/mail-templates'
                            ]
                    ]);


                $message = \Yii::$app->mailer->compose('@app/mail/password-reset-token', [
                    'user' => $user,
                    'resetLink' => $resetLink
                ])
                    ->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName])
                    ->setTo($user->email)
                    ->setSubject(\Yii::t('skeeks/cms',
                            'The request to change the password for') . \Yii::$app->cms->appName);

                return $message->send();
            }
        }

        return false;
    }
174491
def send_reset_password_email(self, user, user_email):
        """"""

        # Verify config settings
        if not self.user_manager.USER_ENABLE_EMAIL: return
        assert self.user_manager.USER_ENABLE_FORGOT_PASSWORD

        # The reset_password email is sent to a specific user_email.email or user.email
        email = user_email.email if user_email else user.email

        # Generate a reset_password_link
        token = self.user_manager.generate_token(user.id)
        reset_password_link = url_for('user.reset_password', token=token, _external=True)

        # Render email from templates and send it via the configured EmailAdapter
        self._render_and_send_email(
            email,
            user,
            self.user_manager.USER_RESET_PASSWORD_EMAIL_TEMPLATE,
            reset_password_link=reset_password_link,
        )
154326
public function send()
    {
        $appEncoding = Configuration::read('application.encoding');
        $encoding = new Encoding();
        $subject = $this->addEncodeTag($this->subject);
        $headerContent = $this->getHeaderContent();
        $mailContent = $this->getEmailContent();
        if ($appEncoding != $this->charset) {
            $subject = $encoding->convert($subject, $appEncoding, $this->charset);
            $headerContent = $encoding->convert($headerContent, $appEncoding, $this->charset);
            $mailContent = $encoding->convert($mailContent, $appEncoding, $this->charset);
        }
        return mail($this->getRecipientTo(), $this->subject, $mailContent, $headerContent);
    }
861311
def send_reset_password_link(request):
    '''
    
    '''
    if not registration_settings.RESET_PASSWORD_VERIFICATION_ENABLED:
        raise Http404()
    serializer = SendResetPasswordLinkSerializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    login = serializer.validated_data['login']

    user = None
    for login_field in get_login_fields():
        user = get_user_by_lookup_dict(
            {login_field: login}, default=None, require_verified=False)
        if user:
            break

    if not user:
        raise UserNotFound()

    signer = ResetPasswordSigner({
        'user_id': user.pk,
    }, request=request)

    template_config = (
        registration_settings.RESET_PASSWORD_VERIFICATION_EMAIL_TEMPLATES)
    send_verification_notification(user, signer, template_config)

    return get_ok_response('Reset link sent')
647298
public function send()
    {
        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval', true);
        if (!is_array($aParams)) {
            return;
        }

        // storing used written values
        $oParams = (object) $aParams;
        $this->setSuggestData((object) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval'));

        $oUtilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView();

        // filled not all fields ?
        foreach ($this->_aReqFields as $sFieldName) {
            if (!isset($aParams[$sFieldName]) || !$aParams[$sFieldName]) {
                $oUtilsView->addErrorToDisplay('SUGGEST_COMLETECORRECTLYFIELDS');

                return;
            }
        }

        if (!oxNew(\OxidEsales\Eshop\Core\MailValidator::class)->isValidEmail($aParams["rec_email"]) || !oxNew(\OxidEsales\Eshop\Core\MailValidator::class)->isValidEmail($aParams["send_email"])) {
            $oUtilsView->addErrorToDisplay('SUGGEST_INVALIDMAIL');

            return;
        }

        $sReturn = "";
        // #1834M - specialchar search
        $sSearchParamForLink = rawurlencode(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('searchparam', true));
        if ($sSearchParamForLink) {
            $sReturn .= "&searchparam=$sSearchParamForLink";
        }

        $sSearchCatId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('searchcnid');
        if ($sSearchCatId) {
            $sReturn .= "&searchcnid=$sSearchCatId";
        }

        $sSearchVendor = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('searchvendor');
        if ($sSearchVendor) {
            $sReturn .= "&searchvendor=$sSearchVendor";
        }

        if (($sSearchManufacturer = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('searchmanufacturer'))) {
            $sReturn .= "&searchmanufacturer=$sSearchManufacturer";
        }

        $sListType = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('listtype');
        if ($sListType) {
            $sReturn .= "&listtype=$sListType";
        }

        // sending suggest email
        $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);
        $oProduct = $this->getProduct();
        if ($oProduct && $oEmail->sendSuggestMail($oParams, $oProduct)) {
            return 'details?anid=' . $oProduct->getId() . $sReturn;
        } else {
            $oUtilsView->addErrorToDisplay('SUGGEST_INVALIDMAIL');
        }
    }
1054528
public function sendEmail()
    {
        $user = User::findOne([
            'email' => $this->email,
            'status' => User::STATUS_INACTIVE
        ]);

        if ($user === null) {
            return false;
        }

        return Yii::$app
            ->mailer
            ->compose(
                ['html' => 'emailVerify-html', 'text' => 'emailVerify-text'],
                ['user' => $user]
            )
            ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
            ->setTo($this->email)
            ->setSubject('Account registration at ' . Yii::$app->name)
            ->send();
    }
78052
public function sendResetLinkEmail(Request $request)
    {
        $form = $this->form(new EmailResetForm());

        $form->handleRequest($request);

        if ($form->isNotValid()) {
            return back()->withErrors($form->errors()->all());
        }

        $response = $this->broker()->sendResetLink([
            'email' => $form->repository()->getFieldByName('email')->getValue()
        ]);

        return $response == Password::RESET_LINK_SENT
            ? $this->sendResetLinkResponse($request, $response)
            : $this->sendResetLinkFailedResponse($request, $response);
    }
513076
public function sendResetLinkEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = Password::broker()->sendResetLink($request->only('email'));

        switch ($response) {
            case Password::RESET_LINK_SENT:
                alert()->success('Success!',
                    'Please check your inbox for the email with instructions');

                $this->logLogin($request, 'password-forgot');

                return redirect(route('login'));

            default:
                return redirect()
                    ->back()
                    ->withInput($request->only('email'))
                    ->withErrors(['email' => trans($response)]);
        }
    }
1123387
public function toMail()
    {
        return (new MailMessage())
            ->line('You are receiving this email because we received a password reset request for your account.')
            ->action('Reset Password', url(config('app.url').route('platform.password.reset', $this->token, false)))
            ->line('If you did not request a password reset, no further action is required.');
    }
859205
public function sendEmail()
    {
        
        $identityClass = \Yii::$app->user->identityClass;
        /* @var $user User */
        $user = $identityClass::findOne([
                    //  'status' => $identityClass::STATUS_ACTIVE,
                    'email' => $this->email,
        ]);

        if (!$user) {

            return false;
        }

        if (!$identityClass::isPasswordResetTokenValid($user->password_reset_token)) {

            $user->generatePasswordResetToken();
        }

        if (!$user->save()) {
     
            return false;
        }

        return Yii::$app
                        ->mailer
                        ->compose(
                                ['html' => '@vendor/humanized/yii2-advanced-application-template-user/mail/passwordResetToken-html', 'text' => '@vendor/humanized/yii2-advanced-application-template-user/mail/passwordResetToken-text'], ['user' => $user]
                        )
                        ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
                        ->setTo($this->email)
                        ->setSubject('Password ' . ($user->status != 0 ? 're' : '') . 'set for ' . Yii::$app->name)
                        ->send();
    }
924867
public function sendEmail()
    {
        if (($this->owner->type != Item::TYPE_EMAIL) || (!$config = $this->owner->getEmailConfig())) {
            return true;
        }
        $this->setFromConfig($config);
        return \Yii::$app->mail->compose()
            ->setFrom(\Yii::$app->params['adminEmail'])
            ->setTo($this->owner->address)
            ->setSubject($this->owner->title)
            ->setHtmlBody($this->owner->content)
            ->send()
            ? ($this->owner->status = Item::STATUS_SUCCESS)
            : ($this->owner->status = Item::STATUS_ERROR);
    }
645112
public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

        return $response == Password::RESET_LINK_SENT
            ? $this->sendResetLinkResponse($request, $response)
            : $this->sendResetLinkFailedResponse($request, $response);
    }
844840
public function resetPassword()
    {
        $identity = $this->getIdentity();
        if (($message = $identity->resetPassword($this->newPassword)) !== true) {
            $this->addError('newPassword', is_string($message) ? $message : Yii::t('usr', 'Failed to reset the password.'));

            return false;
        }

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

        return $user->save();
    }
1054612
public function resetPassword()
    {
        $user = $this->user;
        $user->setPassword($this->password);
        $user->removePasswordResetToken();

        return $user->save();
    }
1010593
public function actionRequestPasswordReset()
    {
        $model = new PasswordResetRequest();
        if ($model->load(Yii::$app->getRequest()->post()) && $model->validate()) {
            if ($model->sendEmail()) {
                Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.');

                return $this->goHome();
            } else {
                Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.');
            }
        }

        return $this->render('requestPasswordResetToken', [
                'model' => $model,
        ]);
    }
1249816
public function getEmailResetPassword()
    {
        if ($this->offsetExists('email') && isset($this->email['resetPasswordTemplate'])) {
            return (string) $this->email['resetPasswordTemplate'];
        }
        return false;
    }