public function action_register() { $username = $_POST["username"]; $password = $_POST["password"]; $role = $_POST["role"]; $return->result = RiverId::register($username, $password, $role); $this->request->response = json_encode($return); }
public function RunChecks($postVar) { $this->firsttime = count($postVar) == 0; if ($this->firsttime) { return null; } if (!key_exists("password1", $postVar) || strlen($postVar["password1"]) == 0) { $this->errors[] = "You have to enter a password in the first box."; } if (!key_exists("password2", $postVar) || strlen($postVar["password2"]) == 0) { $this->errors[] = "You have to enter a password in the second box."; } if (count($this->errors) > 0) { return false; } $password1 = $postVar["password1"]; $password2 = $postVar["password2"]; if ($password1 != $password2) { $this->errors[] = "The passwords you entered did not match."; } if (count($this->errors) > 0) { return false; } if (strlen($password1) < 6) { $this->errors[] = "The password you choose must be at lease 6 characters long."; } if (count($this->errors) > 0) { return false; } try { include_once dirname(__FILE__) . "/../../web/modules/riverid/classes/riverid.php"; include_once dirname(__FILE__) . "/../../web/modules/riverid/classes/riveridconfig.php"; RiverId::register("admin", $password1, "admin"); return true; } catch (\Exception $e) { $this->errors[] = "There was a problem registering the admin username and password: {$e}"; return false; } }
public function test() { include_once dirname(__FILE__) . "/../../../../../web/modules/riverid/classes/RiverId.php"; include_once dirname(__FILE__) . "/../../../../../web/modules/riverid/classes/RiverIdConfig.php"; \RiverId::register("test2", "password", "sweeper"); }