forked from Business/AccountHub
		
	Add API methods for supporting mobile APIs on other apps
This commit is contained in:
		
							parent
							
								
									368a9c7e31
								
							
						
					
					
						commit
						766db4f3c4
					
				
							
								
								
									
										11
									
								
								api.php
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								api.php
									
									
									
									
									
								
							| @ -255,9 +255,18 @@ switch ($VARS['action']) { | |||||||
|         $hasperm = account_has_permission($user, $perm); |         $hasperm = account_has_permission($user, $perm); | ||||||
|         exit(json_encode(["status" => "OK", "has_permission" => $hasperm])); |         exit(json_encode(["status" => "OK", "has_permission" => $hasperm])); | ||||||
|         break; |         break; | ||||||
|  |     case "mobileenabled": | ||||||
|  |         exit(json_encode(["status" => "OK", "mobile" => MOBILE_ENABLED])); | ||||||
|  |     case "mobilevalid": | ||||||
|  |         if (is_empty($VARS['username']) || is_empty($VARS['code'])) { | ||||||
|  |             http_response_code(400); | ||||||
|  |             die("\"400 Bad Request\""); | ||||||
|  |         } | ||||||
|  |         $user_key_valid = $database->has('mobile_codes', ['[>]accounts' => ['uid' => 'uid']], ["AND" => ['mobile_codes.code' => $VARS['code'], 'accounts.username' => $VARS['username']]]); | ||||||
|  |         exit(json_encode(["status" => "OK", "valid" => $user_key_valid])); | ||||||
|     default: |     default: | ||||||
|         http_response_code(404); |         http_response_code(404); | ||||||
|         die(json_encode(["status" => "ERROR", "msg" => "The requested action is not available."])); |         die(json_encode("404 Not Found: the requested action is not available.")); | ||||||
| } | } | ||||||
|     /* } catch (Exception $e) { |     /* } catch (Exception $e) { | ||||||
|       header("HTTP/1.1 500 Internal Server Error"); |       header("HTTP/1.1 500 Internal Server Error"); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user