]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/registeruser.php
Merge branch 'cas-user-whitelist' into 'nightly'
[quix0rs-gnu-social.git] / scripts / registeruser.php
old mode 100644 (file)
new mode 100755 (executable)
index 8aab325..97caf64
@@ -49,7 +49,7 @@ if (empty($nickname) || empty($password)) {
 
 try {
 
-    $user = User::staticGet('nickname', $nickname);
+    $user = User::getKV('nickname', $nickname);
 
     if (!empty($user)) {
         throw new Exception("A user named '$nickname' already exists.");
@@ -60,7 +60,7 @@ try {
                                  'fullname' => $fullname));
 
     if (empty($user)) {
-        throw new Exception("Cannot register user '$nickname' with password '$password' and fullname '$fullname'.");
+        throw new Exception("Can't register user '$nickname' with password '$password' and fullname '$fullname'.");
     }
 
     if (!empty($email)) {
@@ -69,10 +69,8 @@ try {
 
         $user->email = $email;
 
-        if (!$user->updateKeys($orig)) {
-            print "Failed!\n";
-            throw new Exception("Cannot update email address.");
-        }
+        // Throws exception on failure.
+        $user->updateWithKeys($orig);
     }
 
 } catch (Exception $e) {