diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index e31656c0..04454cea 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -1,7 +1,7 @@ validate($request, [ - 'name' => 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|min:6|confirmed', - ]); - $user = User::forceCreate([ 'name' => $request->name, 'email' => $request->email, @@ -75,15 +69,11 @@ public function getLogin() /** * Handle a login request to the application. * - * @param Request $request + * @param LoginRequest $request * @return Response */ - public function postLogin(Request $request) + public function postLogin(Requests\Auth\LoginRequest $request) { - $this->validate($request, [ - 'email' => 'required', 'password' => 'required' - ]); - $credentials = $request->only('email', 'password'); if ($this->auth->attempt($credentials, $request->has('remember'))) diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index f54875a0..879796a0 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -1,7 +1,7 @@ validate($request, ['email' => 'required']); - switch ($response = $this->passwords->sendResetLink($request->only('email'))) { case PasswordBroker::INVALID_USER: @@ -86,10 +84,10 @@ public function getReset($token = null) /** * Reset the given user's password. * - * @param Request $request + * @param ResetPasswordRequest $request * @return Response */ - public function postReset(Request $request) + public function postReset(Requests\Auth\ResetPasswordRequest $request) { $credentials = $request->only( 'email', 'password', 'password_confirmation', 'token' diff --git a/app/Http/Requests/Auth/EmailPasswordLinkRequest.php b/app/Http/Requests/Auth/EmailPasswordLinkRequest.php new file mode 100644 index 00000000..30fcb177 --- /dev/null +++ b/app/Http/Requests/Auth/EmailPasswordLinkRequest.php @@ -0,0 +1,29 @@ + 'required', + ]; + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return true; + } + +} diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php new file mode 100644 index 00000000..cbe42d3e --- /dev/null +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -0,0 +1,29 @@ + 'required', 'password' => 'required', + ]; + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return true; + } + +} diff --git a/app/Http/Requests/Auth/RegisterRequest.php b/app/Http/Requests/Auth/RegisterRequest.php new file mode 100644 index 00000000..a1215732 --- /dev/null +++ b/app/Http/Requests/Auth/RegisterRequest.php @@ -0,0 +1,31 @@ + 'required|max:255', + 'email' => 'required|email|max:255|unique:users', + 'password' => 'required|min:6|confirmed', + ]; + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return true; + } + +} diff --git a/app/Http/Requests/Auth/ResetPasswordRequest.php b/app/Http/Requests/Auth/ResetPasswordRequest.php new file mode 100644 index 00000000..366cb5b9 --- /dev/null +++ b/app/Http/Requests/Auth/ResetPasswordRequest.php @@ -0,0 +1,31 @@ + 'required', + 'email' => 'required', + 'password' => 'required|confirmed', + ]; + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return false; + } + +}