Newer
Older
flow-task / server / App / routes_map.php
@root root 20 days ago 498 bytes ---
<?php

namespace App;

function init_routes_map($router) {
	$router -> linking("GET", "signup", function(){
		$uname = $_GET["username"];
		$password = $_GET["password"];

		$auth = new Auth();

		if($auth -> user_name_is_exists($uname)) {
			return error_response("signup", "User name already exists");
		}

		$user_id = $auth -> signup($uname, $password);

		if(!$user_id) {
			return error_response("signup", "Unknown error");
		}

		return success_reponse("signup", ["status" => true]);
	});
}