Created
December 10, 2014 15:38
-
-
Save ChrisFrench/3272d507f65410a43118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Api\Site\Controllers; | |
class Auth extends Base { | |
public function beforeroute() { | |
$array = $this->input->getArray (); | |
if (empty ( $array ['key'] )) { | |
\Dsc\Mongo\Collections\Logs::add('KEY WAS EMPTY'); | |
$this->apiError ('Key is required' ); | |
} else { | |
$key = $array ['key']; | |
//\Dsc\Mongo\Collections\Logs::add($key); | |
} | |
$actor = (new \Rystband\Models\Users ())->setState ( 'filter.auto_login_token', $key )->getItem (); | |
if (empty ( $actor->id )) { | |
$this->apiError( 'Invalid Key, login again to refresh your key'); | |
\Dsc\Mongo\Collections\Logs::add('Invalid Key, login again to refresh your key'); | |
} else { | |
$this->app->set ( 'user', $actor ); | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment