diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/auth.php | 21 | ||||
-rw-r--r-- | inc/html.php | 17 |
2 files changed, 36 insertions, 2 deletions
diff --git a/inc/auth.php b/inc/auth.php index 26be26d45..9b70e2db6 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -382,6 +382,19 @@ function register(){ return false; } + if ($conf['autopasswd']) { + $pass = auth_pwgen(); // automatically generate password + } elseif (empty($_POST['pass']) || + empty($_POST['passchk'])) { + msg($lang['reqmissing'], -1); // complain about missing passwords + return false; + } elseif ($_POST['pass'] != $_POST['passchk']) { + msg($lang['reqbadpass'], -1); // complain about misspelled passwords + return false; + } else { + $pass = $_POST['pass']; // accept checked and valid password + } + //check mail if(!mail_isvalid($_POST['email'])){ msg($lang['regbadmail'],-1); @@ -389,14 +402,18 @@ function register(){ } //okay try to create the user - $pass = auth_pwgen(); $pass = auth_createUser($_POST['login'],$pass,$_POST['fullname'],$_POST['email']); if(empty($pass)){ msg($lang['reguexists'],-1); return false; } - //send him the password + if (!$conf['autopasswd']) { + msg($lang['regsuccess2'],1); + return true; + } + + // autogenerated password? then send him the password if (auth_sendPassword($_POST['login'],$pass)){ msg($lang['regsuccess'],1); return true; diff --git a/inc/html.php b/inc/html.php index e6cf77ab0..0b88d813a 100644 --- a/inc/html.php +++ b/inc/html.php @@ -741,6 +741,7 @@ function html_msgarea(){ */ function html_register(){ global $lang; + global $conf; global $ID; print p_locale_xhtml('register'); @@ -755,6 +756,22 @@ function html_register(){ <?=$lang['user']?> <input type="text" name="login" class="edit" size="50" value="<?=formText($_POST['login'])?>" /> </label><br /> + + <?php + if (!$conf['autopasswd']) { + ?> + <label> + <?=$lang['pass']?> + <input type="password" name="pass" class="edit" size="50" /> + </label><br /> + <label> + <?=$lang['passchk']?> + <input type="password" name="passchk" class="edit" size="50" /> + </label><br /> + <?php + } + ?> + <label> <?=$lang['fullname']?> <input type="text" name="fullname" class="edit" size="50" value="<?=formText($_POST['fullname'])?>" /> |