PHP code example of syehan / forgotpassword-plugin
1. Go to this page and download the library: Download syehan/forgotpassword-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
syehan / forgotpassword-plugin example snippets
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'); //<- only allow set `queue` or `send` mode
$is_otp_match = (new \Syehan\ForgotPassword\Classes\OtpMaker)->setIssuer($email)->verifyOtp($input_otp);
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();
return [
/**
* The User Model, default is rainlab.user plugin.
* this would be the model that allow us to change the password.
*
*/
'user_model' => env('SYEHAN_FORGOT_PASSWORD_USER_MODEL', \RainLab\User\Models\User::class),
/**
* The OTP secret key, identity of your app
*/
'otp_secret_key' => env('SYEHAN_FORGOT_PASSWORD_OTP_SECRET_KEY', 'XFT35ETTPHPIBIAMIUEZ7SRE5K4YZLSQP3LU4DZFWW7NDUSRSGAR3JK2ETCXY4BYQIQQQRLX4GI2ZSUT4YQDWEEPMAMI75IHN6NBKBQYCCKPQZGBTJQJYBIBU4LGEBGMVRUW6XZFVSOUUVRL66NFIZ55CH7GIGWUJ5DMR2JRYCTMXUN2ZMVFCBWEJNOOJIMGLIAGZXIJOVGIY'),
/**
* The OTP issuer
*/
'otp_issuer' => env('SYEHAN_FORGOT_PASSWORD_OTP_ISSUER', 'SyehanProductIssuer'),
/**
* Length of OTP digits, by default is 6.
*/
'otp_digits' => env('SYEHAN_FORGOT_PASSWORD_OTP_DIGITS', 6),
/**
* The OTP digest algorithm, by default is sha1.
*/
'otp_algorithm' => env('SYEHAN_FORGOT_PASSWORD_OTP_ALGORITHM', 'sha1'),
/**
* The Interval of OTP will be valid, by default is 60 second.
*/
'otp_period' => env('SYEHAN_FORGOT_PASSWORD_OTP_PERIOD', 60),
/**
* Company Name is basically for using our default mail template which must
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.