]> andersk Git - sql-web.git/blobdiff - batch/signup.php
use nicepass for batch signup passwords
[sql-web.git] / batch / signup.php
index 78655427cf425f09385e1e5bf3f25a767106b4ef..99785226b2b3dc2ce762eadf19bc86910f300094 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/php -q
 <?php
 
 require_once(dirname(__FILE__).'/../mitsql.cfg.php');
@@ -8,6 +8,8 @@ require_once('batch.inc.php');
 
 $myUsername = $argv[1];
 $myUID = $argv[3];
+if ($myUID<100) exit('bad UID');
+
 $hescmd = "hesinfo $myUsername passwd";
 $hesinfo = explode(':', trim(exec($hescmd)));
 if (count($hesinfo)>=4) {
@@ -17,9 +19,8 @@ if (count($hesinfo)>=4) {
        $myName = $myUsername;
 }
 $myEmail = $myUsername.'@mit.edu';
-$myPassword = substr(md5(uniqid(),0,8));
-
-if ($myUID<1000) exit('bad UID');
+$myPassword = trim(exec(dirname(__FILE__).'/../bin/nicepass.py'));
+if (empty($myPassword)) exit('bad Password');
 
 $Login = new Login($myUsername);
 if (!$Login->exists() && !empty($myUsername)) {
@@ -29,7 +30,7 @@ if (!$Login->exists() && !empty($myUsername)) {
 if ($Login->canSignup()) {
        $User = new User($Login->getUserId());
        $User->signup($myPassword);
-       die($myPassword);
+       exit($myPassword);
 }
 
 ?>
This page took 0.052417 seconds and 4 git commands to generate.