aboutsummaryrefslogtreecommitdiff
path: root/src/controllers
diff options
context:
space:
mode:
authorCamil Staps2015-05-24 22:42:26 +0200
committerCamil Staps2015-05-24 22:42:26 +0200
commitea7966cc6823ddaa349740e438c4f0cb588f5b32 (patch)
treeab5e2bb9de2b64ee3cdc7d5c0bfbca61ce742335 /src/controllers
parentUsing email as id; User & PasswordReminder (diff)
User id -> email in other classes
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/PasswordReminderController.php8
-rw-r--r--src/controllers/UserTokenController.php12
2 files changed, 10 insertions, 10 deletions
diff --git a/src/controllers/PasswordReminderController.php b/src/controllers/PasswordReminderController.php
index ed3592e..569973b 100644
--- a/src/controllers/PasswordReminderController.php
+++ b/src/controllers/PasswordReminderController.php
@@ -23,13 +23,13 @@ class PasswordReminderController extends BaseController {
}
/**
- * Set the userId and create a random token
- * @param $userId
+ * Set the userEmail and create a random token
+ * @param $userEmail
* @throws StoreResourceFailedException
* @return PasswordReminder
*/
- public function store($userId) {
- $user = User::findOrFail($userId);
+ public function store($userEmail) {
+ $user = User::findOrFail($userEmail);
$this->passwordReminder->userEmail = $user->email;
$this->passwordReminder->token = bin2hex(openssl_random_pseudo_bytes(24));
diff --git a/src/controllers/UserTokenController.php b/src/controllers/UserTokenController.php
index 20bd06c..fe0d37d 100644
--- a/src/controllers/UserTokenController.php
+++ b/src/controllers/UserTokenController.php
@@ -16,22 +16,22 @@ class UserTokenController extends BaseController {
/**
* Only the tokens of the authenticated user are shown
*/
- public function index() {
- return $this->userToken->where('userId', '=', Auth::user()->id)->get();
+ public function index($userEmail = null) {
+ return $this->userToken->where('userEmail', Auth::user()->email)->get();
}
/**
* Only the tokens of the authenticated user are available
*/
- public function show($id) {
- return $this->userToken->where('userId', '=', Auth::user()->id)->findOrFail($id);
+ public function show($userEmail, $id) {
+ return $this->userToken->where('userEmail', Auth::user()->email)->findOrFail($id);
}
/**
- * Set the userId and create a random token
+ * Set the userEmail and create a random token
*/
public function store() {
- $this->userToken->userId = Auth::user()->id;
+ $this->userToken->userEmail = Auth::user()->email;
$this->userToken->token = base64_encode(openssl_random_pseudo_bytes(64));
if ($this->userToken->save()) {