diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php index 7d76618..46cdd6e 100644 --- a/skolehjem/app/Http/Controllers/UserController.php +++ b/skolehjem/app/Http/Controllers/UserController.php @@ -166,16 +166,16 @@ class UserController extends Controller //$user->save(); } else { // Else if you're not on the admin site (user site) if ($request->input('password') != null) { // If you're editing the password - if ($request->input('password') != $request->input('confirmpassword')) { // If new password and new password confirm is not the same, go back. - return Response::detect("users.editpass"); - } elseif (!Hash::check($request->input('oldpassword'), $user->password)) { // If the written current password and current password in DB is not the same, go back. - return Response::detect("users.editpass"); + if ($request->input('password') != $request->input('confirmpassword')) { // If new password and new password confirm is not the same, go back with fail message. + return redirect()->route("users.accounteditpass")->with('error#notsamepass', '

Der stod ikke det samme i `Nyt Password` & `Bekræft Nyt Password`!

'); + } elseif (!Hash::check($request->input('oldpassword'), $user->password)) { // If the written current password and current password in DB is not the same, go back with fail message. + return redirect()->route("users.accounteditpass")->with('error#oldpass', '

Det indtastede password i `Nuværende Password` er ikke dit nuværende password!

'); } else { // If new password and current password is the same AND current written and current DB password is the same. Then update and logout. /** @var User $user */ $user->update($data); Auth::logout(); - return redirect()->route("users.login"); + return redirect()->route("users.login")->with('success#passwordchange', '

Dit password er hermed ændret!

'); } } else { // Else if you're not editing the password but anything else (Email, Phone Number). Then update user. $user->update($data); diff --git a/skolehjem/resources/views/app/users/editpass.blade.php b/skolehjem/resources/views/app/users/editpass.blade.php index e04e51c..4453086 100644 --- a/skolehjem/resources/views/app/users/editpass.blade.php +++ b/skolehjem/resources/views/app/users/editpass.blade.php @@ -16,6 +16,8 @@ Bekræft Nyt Password: + {!! session()->get('error#notsamepass') !!} + {!! session()->get('error#oldpass') !!} diff --git a/skolehjem/resources/views/app/users/login.blade.php b/skolehjem/resources/views/app/users/login.blade.php index 52c34cd..e13dc07 100644 --- a/skolehjem/resources/views/app/users/login.blade.php +++ b/skolehjem/resources/views/app/users/login.blade.php @@ -19,6 +19,7 @@ Remember password + {!! session()->get('success#passwordchange') !!} Forgot password?