aboutsummaryrefslogtreecommitdiff
path: root/src/controllers/PasswordReminderController.php
diff options
context:
space:
mode:
authorCamil Staps2015-05-18 20:39:36 +0200
committerCamil Staps2015-05-18 20:39:36 +0200
commit4324c9a154918abcf14d148ac06648d6a1889d3e (patch)
tree4c877ac52131619d5edd2ce525d92270617e46f0 /src/controllers/PasswordReminderController.php
parentSeems to work (diff)
Exception handlers compatibility without dingo facade; fixed namespaces
Diffstat (limited to 'src/controllers/PasswordReminderController.php')
-rw-r--r--src/controllers/PasswordReminderController.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/controllers/PasswordReminderController.php b/src/controllers/PasswordReminderController.php
index 622e92c..bf9d959 100644
--- a/src/controllers/PasswordReminderController.php
+++ b/src/controllers/PasswordReminderController.php
@@ -9,7 +9,9 @@
namespace CamilStaps\BotleaguesApi\Controllers;
use CamilStaps\BotleaguesApi\Database\PasswordReminder;
+use CamilStaps\BotleaguesApi\Exception\ValidationException;
use Illuminate\Support\Facades\Input;
+use Illuminate\Support\Facades\Validator;
class PasswordReminderController extends BaseController {
@@ -23,6 +25,15 @@ class PasswordReminderController extends BaseController {
* Set the userId and create a random token
*/
public function store() {
+ $rules = [
+ 'user_id' => ['required']
+ ];
+ $payload = Input::only('user_id');
+ $validator = Validator::make($payload, $rules);
+ if ($validator->fails()) {
+ throw new ValidationException('Could not find user.', $validator->errors());
+ }
+
$this->passwordReminder->userId = Input::get('user_id');
$this->passwordReminder->token = base64_encode(openssl_random_pseudo_bytes(64));