mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
AuthApi fix, refactoring
This commit is contained in:
1 parent
09ad9c9eba
commit
d137d08ff4
1 file changed
+17
-17
+17
-17
@@ -1,25 +1,25 @@
|
||||
<?php
|
||||
class AuthApi {
|
||||
static function login(){
|
||||
$token = (new ApiManager)->getToken($this->input->username,$this->input->password);
|
||||
if (!$token) {
|
||||
throw new Exception("Auth failed", 401);
|
||||
}
|
||||
$this->response(['token' => $token]);
|
||||
}
|
||||
public function login(){
|
||||
$token = (new ApiManager)->getToken($this->input->username,$this->input->password);
|
||||
if (!$token) {
|
||||
throw new Exception("Auth failed", 401);
|
||||
}
|
||||
$this->response(['token' => $token]);
|
||||
}
|
||||
|
||||
static function logout(){
|
||||
$authenticationBearrer = $_SERVER['HTTP_AUTHORIZATION'];
|
||||
if (!(new ApiManager)->deleteToken($authenticationBearrer)) {
|
||||
throw new Exception("logout Failed", 401);
|
||||
}
|
||||
}
|
||||
public function logout(){
|
||||
$authenticationBearrer = $_SERVER['HTTP_AUTHORIZATION'];
|
||||
if (!(new ApiManager)->deleteToken($authenticationBearrer)) {
|
||||
throw new Exception("logout Failed", 401);
|
||||
}
|
||||
}
|
||||
|
||||
static function registration(){
|
||||
public function registration(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static function restartPassword(){
|
||||
public function restartPassword(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user