diff options
author | matthias.grimm <matthias.grimm@users.sourceforge.net> | 2005-05-08 22:01:29 +0200 |
---|---|---|
committer | matthias.grimm <matthias.grimm@users.sourceforge.net> | 2005-05-08 22:01:29 +0200 |
commit | cab2716ac2fbdb0903e4d1c357c8fb630fdd6b0d (patch) | |
tree | 60e0f46e797d406c3f15c6d9275b5208596476bf | |
parent | 7c37db8ace6aa37def9e7e926b8e8be34d4cde82 (diff) | |
download | rpg-cab2716ac2fbdb0903e4d1c357c8fb630fdd6b0d.tar.gz rpg-cab2716ac2fbdb0903e4d1c357c8fb630fdd6b0d.tar.bz2 |
user registration without email
This patch extends the user registration with a more direct
way without the need for an valid email address. The user
password is queried in the registration form and not automatically
generated and sent by email. This mode could be configured with the
new option 'autopasswd'. Some new texts were added for translation
but only english and german translation databases have been updated
yet.
darcs-hash:20050508200129-45302-ad4f2cf1d18514c76373cb6d6015e74712638402.gz
-rw-r--r-- | conf/dokuwiki.php | 3 | ||||
-rw-r--r-- | inc/auth.php | 21 | ||||
-rw-r--r-- | inc/html.php | 17 | ||||
-rw-r--r-- | lang/de/lang.php | 5 | ||||
-rw-r--r-- | lang/en/lang.php | 5 |
5 files changed, 46 insertions, 5 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index 591a14eb4..bbc6d86a3 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -51,9 +51,10 @@ $conf['mailguard'] = 'hex'; //obfuscate email addresses against sp /* Authentication Options */ $conf['useacl'] = 0; //Use Access Control Lists to restrict access? $conf['openregister']= 1; //Should users to be allowed to register? +$conf['autopasswd'] = 1; //autogenerate passwords and email them to user $conf['authtype'] = 'plain'; //which authentication DB should be used (currently plain only) $conf['defaultgroup']= 'user'; //Default groups new Users are added to -$conf['superuser'] = '!!not set!!'; //The admin can be user or @group +$conf['superuser'] = '!!not set!!'; //The admin can be user or @group /* Advanced Options */ $conf['userewrite'] = 0; //this makes nice URLs: 0: off 1: .htaccess 2: internal 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'])?>" /> diff --git a/lang/de/lang.php b/lang/de/lang.php index 08924a8d3..9a4e95c43 100644 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -33,6 +33,7 @@ $lang['btn_delete'] = 'Löschen'; $lang['loggedinas'] = 'Angemeldet als'; $lang['user'] = 'Benutzername'; $lang['pass'] = 'Passwort'; +$lang['passchk'] = 'und nochmal'; $lang['fullname'] = 'Voller Name'; $lang['email'] = 'E-Mail'; $lang['remember'] = 'Angemeldet bleiben'; @@ -41,9 +42,11 @@ $lang['badlogin'] = 'Nutzername oder Passwort sind falsch.'; $lang['regmissing'] = 'Alle Felder müssen ausgefüllt werden'; $lang['reguexists'] = 'Der Nutzername existiert leider schon.'; -$lang['regsuccess'] = 'Der neue Nutzer wurde angelegt. Das Passwort wurde per Mail versandt.'; +$lang['regsuccess'] = 'Der neue Nutzer wurde angelegt und das Passwort per Email versandt.'; +$lang['regsuccess2']= 'Der neue Nutzer wurde angelegt.'; $lang['regmailfail']= 'Offenbar ist ein Fehler beim Versenden der Passwortmail aufgetreten. Bitte wenden sie sich an den Wiki-Admin.'; $lang['regbadmail'] = 'Die angegebene Mail-Adresse scheint ungültig zu sein. Falls dies ein Fehler ist, wenden sie sich bitte an den Wiki-Admin.'; +$lang['reqbadpass'] = 'Die beiden eingegeben Passwörter stimmen nicht überein. Bitte versuchen Sie es noch einmal.'; $lang['regpwmail'] = 'Ihr DokuWiki Passwort'; $lang['reghere'] = 'Sie haben noch keinen Zugang? Hier anmelden'; diff --git a/lang/en/lang.php b/lang/en/lang.php index 935398d6d..b56e489c4 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -32,6 +32,7 @@ $lang['btn_delete'] = 'Delete'; $lang['loggedinas'] = 'Logged in as'; $lang['user'] = 'Username'; $lang['pass'] = 'Password'; +$pass['passchk'] = 'once again'; $lang['remember'] = 'Remember me'; $lang['fullname'] = 'Full name'; $lang['email'] = 'E-Mail'; @@ -40,9 +41,11 @@ $lang['badlogin'] = 'Sorry, username or password was wrong.'; $lang['regmissing'] = 'Sorry, you must fill in all fields.'; $lang['reguexists'] = 'Sorry, a user with this login already exists.'; -$lang['regsuccess'] = 'The user was created. The password was sent by mail.'; +$lang['regsuccess'] = 'The user has been created and the password was sent by email.'; +$lang['regsuccess2']= 'The user has been created.'; $lang['regmailfail']= 'Looks like there was an error on sending the password mail. Please contact the admin!'; $lang['regbadmail'] = 'The given email address looks invalid - if you think this is an error, contact the admin'; +$lang['regbadpass'] = 'The two given passwords are not identically, please try again.'; $lang['regpwmail'] = 'Your DokuWiki password'; $lang['reghere'] = 'You don\'t have an account yet? Just get one'; |