when i am update my password in my profile page the password should be changed almost its working fine.but i am not entered any password in the field on that time i click submit button automatically password should generated in db.suggest me something
my html:
<form class="form-horizontal" role="form" id="loginForm" method="POST" action="{{ url('updatepassword') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="post-content col-sm-12">
<h3 class="post-title">Change Password</h3>
<div class="form-group col-xs-5">
<label>Password</label>
<input type="password" class="form-control" name="password">
</div>
<div class="form-group col-xs-5 mm">
<label>Confirm Password</label>
<input type="password" class="form-control" name="password_confirmation">
</div>
<div class="form-group col-xs-2">
<label> </label>
<button id="login" type="submit" class="btn btn-info btn-block btn-flat ">Update</button>
</div>
</div>
</form>
controller:
public function updatepassword(Request $request)
{
$user =new User;
$user->where('email', '=' ,Auth::user()->email)
->update([ 'password' => Hash::make('secret')]);
return Redirect::to('user_profile');
}
router:
Route::post('updatepassword',array('as' =>'password','uses' => 'UserController@updatepassword'));
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire