public function reset($email)
    {
        $rules = [
            'email' => ['required' => true, 'email' => true],
        ];
        $input = [
            'email' => $email,
        ];
        $requireValidate = new Validation($input, $rules);
        if ($requireValidate->fail()) {
            Error::set($requireValidate->error()->get());
        }
        $user = new User();
        if (!$user->isEmail($email)) {
            Error::set(__config()->auth->errors->email_not_exist, 'username');
        }
        if (!$user->isLogin()) {
            if ($this->fail() !== true) {
                $id = $user->getByWhere('email', $email)[0]['id'];
                $resetToken = (new Site())::salts(8);
                $update = new Update();
                $update->update(['resetToken' => $resetToken], $id);
                $link = site_base_url().__config()->auth->reset_password_link.$resetToken;
                $subject = __printl('auth:subject:reset');
                $link = site_base_url().__config()->auth->reset_password_link.'/'.$token;
                $html = __printl('auth:body:reset');
                $html = str_replace(':email', $email, $html);
                $html = str_replace(':link', $link, $html);
                (new EmailHandler($subject, $html, $email));
                Success::set(__printl('auth:success:reset'));
            }
        } else {
            Error::set(__printl('auth:error:already:login'), 'login');
        }
    }
public function reset($email)
    {
        $rules = [
            'email' => ['required' => true, 'email' => true],
        ];
        $input = [
            'email' => $email,
        ];
        $requireValidate = new Validation($input, $rules);
        if ($requireValidate->fail()) {
            Error::set($requireValidate->error()->get());
        }
        $user = new User();
        if (!$user->isEmail($email)) {
            Error::set(__config()->auth->errors->email_not_exist, 'username');
        }
        if (!$user->isLogin()) {
            if ($this->fail() !== true) {
                $id = $user->getByWhere('email', $email)[0]['id'];
                $resetToken = (new Site())::salts(8);
                $update = new Update();
                $update->update(['resetToken' => $resetToken], $id);
                $link = site_base_url().__config()->auth->reset_password_link.$resetToken;
                $subject = __printl('auth:subject:reset');
                $link = site_base_url().__config()->auth->reset_password_link.'/'.$token;
                $html = __printl('auth:body:reset');
                $html = str_replace(':email', $email, $html);
                $html = str_replace(':link', $link, $html);
                (new EmailHandler($subject, $html, $email));
                Success::set(__printl('auth:success:reset'));
            }
        } else {
            Error::set(__printl('auth:error:already:login'), 'login');
        }
    }
public function reset ( $ email ) { $ rules = [ 'email' => [ 'required' => true , 'email' => true ] , ] ; $ input = [ 'email' => $ email , ] ; $ requireValidate = new Validation ( $ input , $ rules ) ; if ( $ requireValidate -> fail ( ) ) { Error :: set ( $ requireValidate -> error ( ) -> get ( ) ) ; } $ user = new User ( ) ; if ( ! $ user -> isEmail ( $ email ) ) { Error :: set ( __config ( ) -> auth -> errors -> email_not_exist , 'username' ) ; } if ( ! $ user -> isLogin ( ) ) { if ( $ this -> fail ( ) !== true ) { $ id = $ user -> getByWhere ( 'email' , $ email ) [ 0 ] [ 'id' ] ; $ resetToken = ( new Site ( ) ) :: salts ( 8 ) ; $ update = new Update ( ) ; $ update -> update ( [ 'resetToken' => $ resetToken ] , $ id ) ; $ link = site_base_url ( ) . __config ( ) -> auth -> reset_password_link . $ resetToken ; $ subject = __printl ( 'auth:subject:reset' ) ; $ link = site_base_url ( ) . __config ( ) -> auth -> reset_password_link . '/' . $ token ; $ html = __printl ( 'auth:body:reset' ) ; $ html = str_replace ( ':email' , $ email , $ html ) ; $ html = str_replace ( ':link' , $ link , $ html ) ; ( new EmailHandler ( $ subject , $ html , $ email ) ) ; Success :: set ( __printl ( 'auth:success:reset' ) ) ; } } else { Error :: set ( __printl ( 'auth:error:already:login' ) , 'login' ) ; } }
Add the reset password request.

@param (string) $email email of user

@since 2.0.3

@return void
Add the reset password request .