From ac28498d8b96733dfa679ec86371aaa6825d3079 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 12 May 2015 18:35:07 +0200 Subject: Authentication with tokens --- src/CamilStaps/BotleaguesApi/User.php | 52 ++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'src/CamilStaps/BotleaguesApi/User.php') diff --git a/src/CamilStaps/BotleaguesApi/User.php b/src/CamilStaps/BotleaguesApi/User.php index 161d285..39b42dc 100644 --- a/src/CamilStaps/BotleaguesApi/User.php +++ b/src/CamilStaps/BotleaguesApi/User.php @@ -1,9 +1,10 @@ isAdministrator; } + public function validToken($token) { + return UserToken::where('userId', $this->id)->where('token', $token)->where('valid_till', '>', date("Y-m-d H:i:s"))->count() > 0; + } + + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() { + return $this->email; + } + + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() { + return null; + } + + /** + * Get the token value for the "remember me" session. + * + * @return string + */ + public function getRememberToken() { + return null; + } + + /** + * Set the token value for the "remember me" session. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) { + return null; + } + + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() { + return null; + } } \ No newline at end of file -- cgit v1.2.3