Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - the introduced actual password should be equal to the actual password of the user (users table has a column "password" on db)
- - the new_password and new_password_confirm should be equal
- - the actual_password and new_password should be different
- public function updatePassword(Request $request){
- $this->validate($request, [
- 'actual_password' => 'required|string|min:6|confirmed',
- 'new_password' => 'required|string|min:6',
- 'new_password_confirm' => 'required|string|min:6|same:new_password',
- ]);
- $user = Auth::user();
- $user->password = bcrypt($request->new_password);
- $user->save();
- Session::flash('success', 'updated.');
- return redirect()->back();
- }
- <form method="post" action="{{route('user.updatePassword')}}" class="clearfix">
- {{csrf_field()}}
- <div>
- <label>New Password</label>
- <input type="password" class="form-control" name="actual_password" id="actual_password" placeholder="">
- </div>
- <div>
- <label for="new_password">New Password</label>
- <input type="password" class="form-control" name="new_password" id="new_password" placeholder="">
- </div>
- <div>
- <label>Confirm password</label>
- <input type="password" name="new_password_confirm" class="form-control" id="new_password_confirm" placeholder="">
- </div>
- <div class="form-group">
- <input type="submit" value="Update password"/>
- </div>
- </form>
Add Comment
Please, Sign In to add comment