示例#1
0
 /**
  * Creates a User on the server with the given parameters.
  * @param string $username The user name of the user to create.
  * @param string $password The password of the user to create.
  * @return \PhoenixSNS\Objects\User|NULL The newly-created User, or NULL if the creation operation failed.
  */
 public static function Create($username, $password)
 {
     $item = new User();
     $item->UserName = $username;
     $item->Password = $password;
     if ($item->Update()) {
         return $item;
     }
     return null;
 }
示例#2
0
    $user = new User();
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $user->UserName = $_POST["user_LoginID"];
        $user->DisplayName = $_POST["user_DisplayName"];
        $user->Update();
        System::Redirect("~/users");
    } else {
        $page = new UserManagementPage();
        $page->CurrentObject = null;
        $page->Render();
    }
    return true;
}), new ModulePage("modify", function ($page, $path) {
    $user = User::GetByID($path[0]);
    if ($user == null) {
        $user = new User();
    }
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $user->UserName = $_POST["user_LoginID"];
        $user->DisplayName = $_POST["user_DisplayName"];
        $user->AccountLocked = $_POST["user_AccountLocked"] != "" ? true : false;
        $user->ForcePasswordChange = $_POST["user_ForcePasswordChange"] != "" ? true : false;
        $user->Update();
        System::Redirect("~/users");
    } else {
        $page = new UserManagementPage();
        $page->CurrentObject = $user;
        $page->Render();
    }
    return true;
})))));