feat: forgot password
config: msg
This commit is contained in:
@@ -74,4 +74,26 @@ class AuthController extends Controller
|
||||
$this->authService->logout($request);
|
||||
return redirect('/login');
|
||||
}
|
||||
|
||||
public function forgotPassword(Request $request)
|
||||
{
|
||||
$validator = \Illuminate\Support\Facades\Validator::make($request->all(), [
|
||||
'mail' => 'required|email|max:255',
|
||||
], [
|
||||
'mail.required' => config('constants.MSG_FORGOT_PWD_EMAIL_REQUIRED'),
|
||||
'mail.email' => config('constants.MSG_FORGOT_PWD_EMAIL_INVALID'),
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withInput()->with('dialog_forgot_error', $validator->errors()->first());
|
||||
}
|
||||
|
||||
$result = $this->authService->forgotPassword($request->input('mail'));
|
||||
|
||||
if (!$result['success']) {
|
||||
return back()->withInput()->with('dialog_forgot_error', $result['error_msg']);
|
||||
}
|
||||
|
||||
return back()->with('dialog_forgot_success', $result['message']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user