php - How to reset password in laravel -
this layout page found below cases:
resetpassword.blade.php
@extends('layouts.default') @section('content') <div id="profileteacher" type="view" class="demo-section k-header"> @include('layouts.common.flash-message') {!! form::open(['url' => 'updatepassword', 'method' => 'post']) !!} <form id="profileteacherform" method="post" action="" > <ul id="fieldlist" > <li> <label style="color:green;font-size:15px">update password</label> </li> <li> <table id="lessonplantable"> <tr> <td><label> current password </label> </td> <td><input type="password" id="curr_password" name="curr_password" class="k-textbox"/></td> </tr> <tr> <td><label> new password </label> </td> <td><input type="password" id="new_password" name="new_password" class="k-textbox"/></td> </tr> <!--tr> <td><label> confirm password </label> </td> <td><input type="password" id="confm_password" name="confm_password" class="k-textbox"/ ></td> </tr--> </table> </li> <li><br> <button id="updateteacherprofile" class="k-button k-primary" type="submit">update</button> </li> <br><br> </ul> </form> </div> @stop
studentcontroller.php
public function updatepassword(request $request) { $curr_password = $request->curr_password; $new_password = $request->new_password; if(!hash::check($curr_password,auth::user()->password)){ echo 'the specified password not match'; } else{ $request->user()->fill(['password' => hash::make($new_password)])->save; echo 'updated successfully'; }
route.php
route::get('/studentresetpassword', function () { return view('layouts.student.resetpassword'); }); route::post('/updatepassword ', 'student\studentcontroller@updatepassword');
no such error in file. process done without getting error.when put current password wrong gives echo message gives echo message "updated successfully" when put current , new password..but in table level updation cannot done..please provide me solution.
your studentcontroller.php
should like:
public function updatepassword(request $request) { $curr_password = $request->curr_password; $new_password = $request->new_password; if(!hash::check($curr_password,auth::user()->password)){ echo 'the specified password not match'; } else{ $request->user()->fill(['password' => hash::make($new_password)])->save(); echo 'updated successfully'; }
Comments
Post a Comment