diff options
Diffstat (limited to 'src/controllers')
-rw-r--r-- | src/controllers/PasswordReminderController.php | 11 | ||||
-rw-r--r-- | src/controllers/UserController.php | 10 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/controllers/PasswordReminderController.php b/src/controllers/PasswordReminderController.php index b3fd8da..ed3592e 100644 --- a/src/controllers/PasswordReminderController.php +++ b/src/controllers/PasswordReminderController.php @@ -31,7 +31,7 @@ class PasswordReminderController extends BaseController { public function store($userId) { $user = User::findOrFail($userId); - $this->passwordReminder->userId = $user->id; + $this->passwordReminder->userEmail = $user->email; $this->passwordReminder->token = bin2hex(openssl_random_pseudo_bytes(24)); if ($this->passwordReminder->save()) { @@ -43,13 +43,16 @@ class PasswordReminderController extends BaseController { /** * Destroy the password reminder means setting a new password for the user - * @param Request $request - * @param $userId + * @param $userEmail + * @param $reminderToken + * @return null */ - public function destroy($userId, $reminderToken) { + public function destroy($userEmail, $reminderToken) { $user = Auth::user(); $user->password = Request::get('password'); $user->save(); + $this->passwordReminder = $this->passwordReminder->findOrFail($reminderToken); + $this->passwordReminder->useToken(); return null; } diff --git a/src/controllers/UserController.php b/src/controllers/UserController.php index 2a454ff..9f70f58 100644 --- a/src/controllers/UserController.php +++ b/src/controllers/UserController.php @@ -40,16 +40,6 @@ class UserController extends BaseController { } public function store() { - $rules = [ - 'email' => ['required', 'email', 'unique:users'], - 'password' => ['required', 'min:7'] - ]; - $payload = Input::only('email', 'password'); - $validator = Validator::make($payload, $rules); - if ($validator->fails()) { - throw new ValidationException('Could not create new user.', $validator->errors()); - } - $this->user->email = Input::get('email'); $this->user->password = Input::get('password'); |