PHPackages                             syehan/forgotpassword-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. syehan/forgotpassword-plugin

ActiveOctober-plugin[Mail &amp; Notifications](/categories/mail)

syehan/forgotpassword-plugin
============================

Allows users who have forgotten their password to unlock, retrieve, or reset it.

v1.2.5(2y ago)261MITPHP

Since Oct 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/syehan/forgotpassword-plugin)[ Packagist](https://packagist.org/packages/syehan/forgotpassword-plugin)[ Docs](https://github.com/syehan/forgotpassword-plugin)[ RSS](/packages/syehan-forgotpassword-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (11)Used By (0)

OctoberCMS Forgot Password
--------------------------

[](#octobercms-forgot-password)

Use `syehan/forgotpassword-plugin`. Allows users who have forgotten their password to unlock, retrieve, or reset it, usually by answering account security questions or sending them an e-mail. This plugin Currently verifying by OTP.

### Installation

[](#installation)

**1** - You can install the package via composer:

```
$ composer require syehan/forgotpassword-plugin
```

### Generating Secret Key Base32 for OTP

[](#generating-secret-key-base32-for-otp)

In this plugin, we have some command to generate base32 for your secret key, after that save into your `config/syehan-otp-password.php` in `otp_secret_key` key like this :

```
php artisan syehan:generate-otp-secret-key

// the output would be like this
Your Forgot Password OTP Secret Key is : Z566IV6FIMMANIKQQOIJDZNWREKJKAWKGTK3WGGBSFTOIOG4UFCN2QVDJNHUJKKT44JRDSPWTX6JNBYDGMIJHLKCD6UM4WJGFIVPU3VSLTXP6J45PG4V5Q2NMKY3H5FCXGXK4BAXHWX4PX3YDC6VYF5EB25GZJCS2LTKED5GA467HIEJHZW6XPVGXPQVMWITQVHILMDQHI7JE

```

### Usage

[](#usage)

**1** - You can send the forgot password email using this API:

```
POST https://yourdomain.com/api/syehan/forgot-password

```

Add body Param `email` to deliver Forgot Password mail to your account.

**2** - Or you can put this function into your function:

```
use Syehan\ForgotPassword\Classes\ForgotMailMaker;

(new ForgotMailMaker)->setEmail($email)->hit();

// You also can change the mail template and mail data for your custom mail like this below. Also we will ensure that otp code and email user added into your mail data.
(new ForgotMailMaker)->setMailTemplateCode('author.plugin::mail.forgot')->setMailData(['data' => 'test'])->setEmail($email)->hit();

// You also can change send mail mode in queue() rather than send(), just change the var like this :
(new ForgotMailMaker)->setEmail($email)->hit('queue'); //setIssuer($email)->verifyOtp($input_otp);
```

### Usage (Change Password)

[](#usage-change-password)

**1** - by this plugin you can also change after verification by using this API:

```
POST https://yourdomain.com/api/syehan/change-password

```

Add body Param `email`, `password` and `password_confirmation` to make sure that change password for your account succeed. Additionally you can verify OTP simultaneously while change password by adding body `otp` request parameter.

or, you can put in any function like this :

```
use Syehan\ForgotPassword\Classes\ChangePasswordMaker;

(new ChangePasswordMaker)
        ->setEmail($email)
        ->setPassword($password)
        ->setPasswordConfirmation($password_confirmation)
        ->change();

// You can verify OTP simultaneously when changing password like this
(new ChangePasswordMaker)
        ->setEmail($email)
        ->setPassword($password)
        ->setPasswordConfirmation($password_confirmation)
        ->withVerifyOtp(true, $otp_input)
        ->change();
```

lastly, you can able to change your own user model by changing `user_model` in `config/syehan-forgot-password.php`

### Config Forgot Password

[](#config-forgot-password)

If your have any setup for forgot password, please make sure to copy our config below and paste in `config/syehan-forgot-password.php`.

```
