Permalink
Browse files

Added option to signon module to check username uniqueness.

All tested OK

#fixes 72
  • Loading branch information...
M4LuZ authored and andygrunwald committed Sep 22, 2018
1 parent 6f88c92 commit 12ae141e96f32fb7384c10e5b80054564f064a82
View
@@ -192,7 +192,7 @@
"modules/usrmgr/Functions/CheckNoSpace.php",
"modules/usrmgr/Functions/CheckOldPW.php",
"modules/usrmgr/Functions/CheckOptGender.php",
"modules/usrmgr/Functions/CheckValidUser.php",
"modules/usrmgr/Functions/CheckValidUsername.php",
"modules/usrmgr/Functions/ClanURLLinkUsrMgrSearch.php",
"modules/usrmgr/Functions/ClanURLLinkUsrMgrSearchInc.php",
"modules/usrmgr/Functions/FieldNeeded.php",
@@ -73,7 +73,7 @@ function CheckValidEmail($email)
}
// Check if we already have a user with that email address
$row = $db->qry_first('SELECT * FROM %prefix%users WHERE email = %string%', $email);
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE email = %string%', $email);
if ($row){
return t('Diese E-Mail-Adresse ist bereits in Verwendung. Bitte verwende die "Passwort zurücksetzen"-Funktion, um dein Passwort zurück zu setzen');
}
@@ -39,6 +39,12 @@
<name>Felder bei Anmeldung</name>
</head>
<items>
<item>
<name>signon_username_unique</name>
<type>boolean</type>
<default>1</default>
<description>Soll der Username einmalig sein?</description>
</item>
<item>
<name>signon_show_firstname</name>
<type>signon</type>

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,17 @@
<?php
/**
* Checks (at the moment only) if the selected username is already existing in the database
*
* @param string $username The username to be checked
* @return bool|mixed|string
*/
function CheckValidUsername($username){
global $cfg, $db;
if ($cfg['signon_username_unique']){
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE username=%string%', $username);
if ($row){
return t('Der gewählte Username existiert bereits');
}
}
return false;
}

0 comments on commit 12ae141

Please sign in to comment.