string("email"); $password = $request->raw("password"); $confirm_password = $request->raw("confirm_password"); if($email) { $csrf = new AntiCSRF(); try { if(!$csrf->validateRequest()) { throw new RuntimeException(__("CSRF validation failed.")); } if($password !== $confirm_password) { throw new RuntimeException(__("Passwords do not match.")); } $user = new User(); $user->title = $request->string("title"); $user->first_name = $request->string("first_name"); $user->last_name = $request->string("last_name"); $user->email = $request->email("email"); $user->password = password_hash($password, PASSWORD_DEFAULT); $user->admin = 1; $user->dts_created = Database::dts(); $user->commit(); Session::addAlert("success", __("User created successfully.")); Http::redirect("/home"); } catch(Exception $e) { Session::addAlert("danger", $e->getMessage()); } } View::include("header"); View::include("setup"); View::include("footer");