Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="{{ route('Agent.ChangePass') }}">
- <input type="hidden" value="{{ csrf_token() }}">
- <div class="col-sm-12 col-md-12">
- <div class="col-sm-12 col-md-12">
- <div class="form-group form-group-sm">
- <label>Old Password: </label>
- <input type="password" class="form-control" name="old_pass" required>
- </div>
- </div>
- <div class="col-sm-12 col-md-12">
- <div class="form-group form-group-sm">
- <label>New Password: </label>
- <input type="password" class="form-control" name="new_pass" required>
- </div>
- </div>
- <div class="col-sm-12 col-md-12">
- <div class="form-group form-group-sm">
- <label>Re-enter New Password: </label>
- <input type="password" class="form-control" name="confirm_pass" required>
- </div>
- <input type="submit" class="btn btn-info btn-sm" value="Save"/>
- </div>
- </div>
- </form>
- Route::post('Agent/ChangePass', 'AgentsController@changePass')->name('Agent.ChangePass');
- public function changePass(Request $request){
- dd($request);
- if (!(Hash::check($request->get('old_pass'), Auth::user()->password))) {
- // The passwords matches
- return redirect()->back()->with("error","Your current password does not matches with the password you provided. Please try again.");
- }
- if(strcmp($request->get('confirm_pass'), $request->get('new_pass')) != 0){
- //Current password and new password are same
- return redirect()->back()->with("error","Your new password does not match your re-entered password.");
- }
- //Change Password
- $user = Auth::user()->id;
- $users = Agent::find($users);
- $users->password = bcrypt($request->get('new_pass'));
- $users->save();
- return redirect()->back()->with("success","Password changed successfully !");
- }
- Route::post('Agent/ChangePass', ['uses' => 'AgentsController@changePass'])->name('Agent.ChangePass');
- action="{{ url('Agent/ChangePass') }}"
Add Comment
Please, Sign In to add comment