php - Password reset in Laravel 5.1 -


kindly tell me how implement password reset functionality in laravel 5.1 application. using jwt give user access system. please, tell me how implement 'forgot passsword' functionality. web api consumed mobile device , user follow steps given below when user understands has forgotten password

1) in login screen user click 'forgot password'

2) in next step, user enter email address , submits.

3) server-side code compares email email registered within system. if match found link(self-destructing) reset password sent email address.

4) user checks email account find link , use reset password.

right code have in user table given down below.

<?php  namespace app; use illuminate\foundation\auth\user authenticatable;  class user extends authenticatable {     /**      * attributes mass assignable.      *      * @var array      */     protected $fillable = [         'name', 'email', 'password',     ];      /**      * attributes should hidden arrays.      *      * @var array      */     protected $hidden = [         'password', 'remember_token',     ];       public function events()     {         return $this->hasmany(event::class);     }       public function request()     {         return $this->hasone(request::class);     } } 

www.laravel.com/docs/5.1/authentication#resetting-passwords

refer there detailed methods.

assuming havent made modification laravel installation. easy make it.

user model editing

implement "illuminate\contracts\auth\canresetpassword" on app\user model.

database table migration

run "php artisan migrate" command on console.

routes

add these routes routes.php file.

// password reset link request routes... route::get('password/email', 'auth\passwordcontroller@getemail'); route::post('password/email', 'auth\passwordcontroller@postemail');  // password reset routes... route::get('password/reset/{token}', 'auth\passwordcontroller@getreset'); route::post('password/reset', 'auth\passwordcontroller@postreset'); 

view files

go resources/views/auth , make 2 new files called

password.blade.php , reset.blade.php

password.blade.php content => "http://pastebin.com/rkcfu130"

reset.blade.php content => "http://pastebin.com/6e5kjqc4"

email view

now make new file called password.blade.php @ resources/views/emails/password.blade.php.

paste inside it.

click here reset password: {{ url('password/reset/'.$token) }} 

post reset redirection

if want redirect user specific url. can paste code passwordcontroller.php. replace "dashboard" link need redirect to.

protected $redirectto = '/dashboard'; 

thats :)


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -