X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fadmin.php;h=a220bccc1f93d44b220d3067f8b0f74496577178;hb=de04c29a5464e6ed6dc0e11a6556ad1c19efd7c4;hp=d4f1390f452610cc25412dbdcb9747271c034fca;hpb=4555d49036d51e04d2a55e1ed11c5c1b3de3feb9;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index d4f1390..a220bcc 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -1515,12 +1515,14 @@ class AdminModule extends PLModule $sex = Post::s('sex'); $email = Post::t('email'); $type = Post::s('type'); - $login = PlUser::makeHrid($firstname, $lastname, $type); - if (!isvalid_email($email)) { + if (!$type) { + $page->trigError("Empty account type"); + } elseif (!isvalid_email($email)) { $page->trigError("Invalid email address: $email"); - } else if (strlen(Post::s('pwhash')) != 40) { + } elseif (strlen(Post::s('pwhash')) != 40) { $page->trigError("Invalid password hash"); } else { + $login = PlUser::makeHrid($firstname, $lastname, $type); $full_name = $firstname . ' ' . $lastname; $directory_name = $lastname . ' ' . $firstname; XDB::execute("INSERT INTO accounts (hruid, type, state, password,