@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function confirmEmail($confirmationCode) |
| 295 | 295 | { |
| 296 | - if ( ! $user = $this->first(['confirmation_code' => $confirmationCode])) |
|
| 297 | - { |
|
| 298 | - \ErrorHandler::invalidConfirmationCode(); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - $user->confirmed = 1; |
|
| 302 | - $user->confirmation_code = null; |
|
| 303 | - $user->save(); |
|
| 296 | + if ( ! $user = $this->first(['confirmation_code' => $confirmationCode])) |
|
| 297 | + { |
|
| 298 | + \ErrorHandler::invalidConfirmationCode(); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + $user->confirmed = 1; |
|
| 302 | + $user->confirmation_code = null; |
|
| 303 | + $user->save(); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -375,26 +375,26 @@ discard block |
||
| 375 | 375 | $this->save($data); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - /** |
|
| 379 | - * Ensure access token hasn't expired or revoked. |
|
| 380 | - * |
|
| 381 | - * @param string $accessToken |
|
| 382 | - * @return boolean |
|
| 383 | - */ |
|
| 384 | - public function accessTokenExpiredOrRevoked($accessToken) |
|
| 385 | - { |
|
| 386 | - $accessTokenId = json_decode($accessToken, true)['id']; |
|
| 387 | - $accessToken = \DB::table('oauth_access_tokens') |
|
| 388 | - ->where('id', $accessTokenId) |
|
| 389 | - ->first(); |
|
| 378 | + /** |
|
| 379 | + * Ensure access token hasn't expired or revoked. |
|
| 380 | + * |
|
| 381 | + * @param string $accessToken |
|
| 382 | + * @return boolean |
|
| 383 | + */ |
|
| 384 | + public function accessTokenExpiredOrRevoked($accessToken) |
|
| 385 | + { |
|
| 386 | + $accessTokenId = json_decode($accessToken, true)['id']; |
|
| 387 | + $accessToken = \DB::table('oauth_access_tokens') |
|
| 388 | + ->where('id', $accessTokenId) |
|
| 389 | + ->first(); |
|
| 390 | 390 | |
| 391 | - if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) |
|
| 392 | - { |
|
| 393 | - return true; |
|
| 394 | - } |
|
| 391 | + if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) |
|
| 392 | + { |
|
| 393 | + return true; |
|
| 394 | + } |
|
| 395 | 395 | |
| 396 | - return false; |
|
| 397 | - } |
|
| 396 | + return false; |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | 399 | /** |
| 400 | 400 | * Revoke the given access token and all |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Get the profile picture url. |
|
| 35 | - * @return string |
|
| 36 | - */ |
|
| 33 | + /** |
|
| 34 | + * Get the profile picture url. |
|
| 35 | + * @return string |
|
| 36 | + */ |
|
| 37 | 37 | public function getProfilePictureAttribute($value) |
| 38 | 38 | { |
| 39 | 39 | return url(\Storage::url($value)); |
@@ -89,27 +89,27 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return array |
| 91 | 91 | */ |
| 92 | - public function routeNotificationForFCM() |
|
| 93 | - { |
|
| 94 | - $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
| 95 | - $tokens = []; |
|
| 96 | - |
|
| 97 | - foreach ($devices as $device) |
|
| 98 | - { |
|
| 99 | - if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) |
|
| 100 | - { |
|
| 101 | - continue; |
|
| 102 | - } |
|
| 103 | - else |
|
| 104 | - { |
|
| 105 | - $device->forceDelete(); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - $tokens[] = $device->device_token; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - return $tokens; |
|
| 112 | - } |
|
| 92 | + public function routeNotificationForFCM() |
|
| 93 | + { |
|
| 94 | + $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
| 95 | + $tokens = []; |
|
| 96 | + |
|
| 97 | + foreach ($devices as $device) |
|
| 98 | + { |
|
| 99 | + if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) |
|
| 100 | + { |
|
| 101 | + continue; |
|
| 102 | + } |
|
| 103 | + else |
|
| 104 | + { |
|
| 105 | + $device->forceDelete(); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + $tokens[] = $device->device_token; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + return $tokens; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * The channels the user receives notification broadcasts on. |
@@ -99,8 +99,7 @@ |
||
| 99 | 99 | if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) |
| 100 | 100 | { |
| 101 | 101 | continue; |
| 102 | - } |
|
| 103 | - else |
|
| 102 | + } else |
|
| 104 | 103 | { |
| 105 | 104 | $device->forceDelete(); |
| 106 | 105 | } |