From ab31980b116ecd497d5d4610c212ae7b1f61fada Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 24 May 2015 17:17:52 +0200 Subject: Password reminders --- .../ActivationCodeAuthenticationProvider.php | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/CamilStaps/BotleaguesApi/ActivationCodeAuthenticationProvider.php (limited to 'src/CamilStaps/BotleaguesApi/ActivationCodeAuthenticationProvider.php') diff --git a/src/CamilStaps/BotleaguesApi/ActivationCodeAuthenticationProvider.php b/src/CamilStaps/BotleaguesApi/ActivationCodeAuthenticationProvider.php new file mode 100644 index 0000000..049dfc4 --- /dev/null +++ b/src/CamilStaps/BotleaguesApi/ActivationCodeAuthenticationProvider.php @@ -0,0 +1,53 @@ +route('user')); + $passwordReminder = PasswordReminder::find($request->route('password_reminder')); + + if (!empty($user) && !empty($passwordReminder) && $passwordReminder->userId == $user->id) { + $passwordReminder->useToken(); + Auth::login($user); + return Auth::user(); + } + + throw new UnauthorizedHttpException(null, "Invalid credentials"); + } + + /** + * Get the providers authorization method. + * + * @return string + */ + public function getAuthorizationMethod() { + return 'activationcode'; + } +} \ No newline at end of file -- cgit v1.2.3