Merge branch 'remastering' of https://git.steelants.cz/SImple-Home/PHP_SMART_HOME_V3 into remastering
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
class AuthApi {
 | 
			
		||||
	public function login(){
 | 
			
		||||
		$token = (new ApiManager)->getToken($this->input->username,$this->input->password);
 | 
			
		||||
		$token = (new AuthManager)->getToken($this->input->username,$this->input->password);
 | 
			
		||||
		if (!$token) {
 | 
			
		||||
			throw new Exception("Auth failed", 401);
 | 
			
		||||
		}
 | 
			
		||||
@@ -10,7 +10,7 @@ class AuthApi {
 | 
			
		||||
 | 
			
		||||
	public function logout(){
 | 
			
		||||
		$authenticationBearrer = $_SERVER['HTTP_AUTHORIZATION'];
 | 
			
		||||
		if (!(new ApiManager)->deleteToken($authenticationBearrer)) {
 | 
			
		||||
		if (!(new AuthManager)->deleteToken($authenticationBearrer)) {
 | 
			
		||||
			throw new Exception("logout Failed", 401);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
class DevicesApi extends ApiController{
 | 
			
		||||
 | 
			
		||||
	public function getAllDevices(){
 | 
			
		||||
	public function default(){
 | 
			
		||||
		$this->requireAuth();
 | 
			
		||||
		$response = [];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								app/api/RoomsApi.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								app/api/RoomsApi.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
class RoomsApi extends ApiController{
 | 
			
		||||
 | 
			
		||||
	public function default(){
 | 
			
		||||
		$this->requireAuth();
 | 
			
		||||
		$response = [];
 | 
			
		||||
 | 
			
		||||
		// TODO: process the request
 | 
			
		||||
 | 
			
		||||
		$this->response($response);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user