add configuration value to restrict registration to an e?mail address (implements #4)
This commit is contained in:
parent
dcfb93ec6b
commit
c512dca087
5 changed files with 37 additions and 22 deletions
|
|
@ -143,6 +143,7 @@
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $misc = array(
|
public static $misc = array(
|
||||||
|
'registration_host' => '',
|
||||||
'ranking_range' => 2,
|
'ranking_range' => 2,
|
||||||
'achievements_range' => 3,
|
'achievements_range' => 3,
|
||||||
'title_delimiter' => ' – ',
|
'title_delimiter' => ' – ',
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,7 @@
|
||||||
|
|
||||||
$fields = array('username', 'prename', 'surname', 'email', 'password');
|
$fields = array('username', 'prename', 'surname', 'email', 'password');
|
||||||
$validation = array();
|
$validation = array();
|
||||||
|
$emailhost = \nre\configs\AppConfig::$misc['registration_host'];
|
||||||
|
|
||||||
// Register a new user
|
// Register a new user
|
||||||
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('register')))
|
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('register')))
|
||||||
|
|
@ -220,6 +221,11 @@
|
||||||
$prename = $this->request->getPostParam('prename');
|
$prename = $this->request->getPostParam('prename');
|
||||||
$surname = $this->request->getPostParam('surname');
|
$surname = $this->request->getPostParam('surname');
|
||||||
$email = $this->request->getPostParam('email');
|
$email = $this->request->getPostParam('email');
|
||||||
|
if(!empty($emailhost)) {
|
||||||
|
if(substr_compare($email, $emailhost, max(0, strlen($email)-strlen($emailhost)), strlen($emailhost)) !== 0) {
|
||||||
|
$validation = $this->Validation->addValidationResult($validation, 'email', 'host', 'invalid');
|
||||||
|
}
|
||||||
|
}
|
||||||
if($this->Users->emailExists($email)) {
|
if($this->Users->emailExists($email)) {
|
||||||
$validation = $this->Validation->addValidationResult($validation, 'email', 'exist', true);
|
$validation = $this->Validation->addValidationResult($validation, 'email', 'exist', true);
|
||||||
}
|
}
|
||||||
|
|
@ -264,6 +270,7 @@
|
||||||
$this->set('prename', $prename);
|
$this->set('prename', $prename);
|
||||||
$this->set('surname', $surname);
|
$this->set('surname', $surname);
|
||||||
$this->set('email', $email);
|
$this->set('email', $email);
|
||||||
|
$this->set('emailhost', $emailhost);
|
||||||
$this->set('validation', $validation);
|
$this->set('validation', $validation);
|
||||||
$this->set('validationSettings', $validationSettings);
|
$this->set('validationSettings', $validationSettings);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,15 +1,15 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: The Legend of Z\n"
|
"Project-Id-Version: The Legend of Z\n"
|
||||||
"POT-Creation-Date: 2015-03-21 14:54+0100\n"
|
"POT-Creation-Date: 2015-04-08 12:28+0100\n"
|
||||||
"PO-Revision-Date: 2015-03-21 14:55+0100\n"
|
"PO-Revision-Date: 2015-04-08 12:29+0100\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: de_DE\n"
|
"Language: de_DE\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"X-Generator: Poedit 1.7.4\n"
|
"X-Generator: Poedit 1.7.5\n"
|
||||||
"X-Poedit-Basepath: ../../../\n"
|
"X-Poedit-Basepath: ../../../\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
"X-Poedit-SourceCharset: UTF-8\n"
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
|
@ -18,7 +18,7 @@ msgstr ""
|
||||||
"X-Poedit-SearchPath-2: controllers\n"
|
"X-Poedit-SearchPath-2: controllers\n"
|
||||||
|
|
||||||
#: controllers/CharactersController.inc:402
|
#: controllers/CharactersController.inc:402
|
||||||
#: controllers/UsersController.inc:322 views/ajax/characters/index.tpl:10
|
#: controllers/UsersController.inc:329 views/ajax/characters/index.tpl:10
|
||||||
#: views/ajax/users/index.tpl:10 views/html/characters/index.tpl:48
|
#: views/ajax/users/index.tpl:10 views/html/characters/index.tpl:48
|
||||||
#: views/html/characters/manage.tpl:35 views/html/characters/manage.tpl:50
|
#: views/html/characters/manage.tpl:35 views/html/characters/manage.tpl:50
|
||||||
#: views/html/characters/manage.tpl:58 views/html/userroles/user.tpl:5
|
#: views/html/characters/manage.tpl:58 views/html/userroles/user.tpl:5
|
||||||
|
|
@ -28,7 +28,7 @@ msgid "Admin"
|
||||||
msgstr "Administrator"
|
msgstr "Administrator"
|
||||||
|
|
||||||
#: controllers/CharactersController.inc:408
|
#: controllers/CharactersController.inc:408
|
||||||
#: controllers/UsersController.inc:328 views/ajax/characters/index.tpl:12
|
#: controllers/UsersController.inc:335 views/ajax/characters/index.tpl:12
|
||||||
#: views/ajax/users/index.tpl:12 views/html/characters/index.tpl:49
|
#: views/ajax/users/index.tpl:12 views/html/characters/index.tpl:49
|
||||||
#: views/html/characters/manage.tpl:36 views/html/characters/manage.tpl:51
|
#: views/html/characters/manage.tpl:36 views/html/characters/manage.tpl:51
|
||||||
#: views/html/characters/manage.tpl:59 views/html/userroles/user.tpl:7
|
#: views/html/characters/manage.tpl:59 views/html/userroles/user.tpl:7
|
||||||
|
|
@ -38,7 +38,7 @@ msgid "Moderator"
|
||||||
msgstr "Moderator"
|
msgstr "Moderator"
|
||||||
|
|
||||||
#: controllers/CharactersController.inc:414
|
#: controllers/CharactersController.inc:414
|
||||||
#: controllers/UsersController.inc:334 views/ajax/characters/index.tpl:14
|
#: controllers/UsersController.inc:341 views/ajax/characters/index.tpl:14
|
||||||
#: views/ajax/users/index.tpl:14 views/html/characters/index.tpl:50
|
#: views/ajax/users/index.tpl:14 views/html/characters/index.tpl:50
|
||||||
#: views/html/characters/manage.tpl:37 views/html/characters/manage.tpl:53
|
#: views/html/characters/manage.tpl:37 views/html/characters/manage.tpl:53
|
||||||
#: views/html/characters/manage.tpl:61 views/html/userroles/user.tpl:9
|
#: views/html/characters/manage.tpl:61 views/html/userroles/user.tpl:9
|
||||||
|
|
@ -1450,7 +1450,7 @@ msgstr "Login"
|
||||||
#: views/html/users/index.tpl:15 views/html/users/index.tpl:19
|
#: views/html/users/index.tpl:15 views/html/users/index.tpl:19
|
||||||
#: views/html/users/index.tpl:20 views/html/users/login.tpl:12
|
#: views/html/users/index.tpl:20 views/html/users/login.tpl:12
|
||||||
#: views/html/users/login.tpl:13 views/html/users/manage.tpl:14
|
#: views/html/users/login.tpl:13 views/html/users/manage.tpl:14
|
||||||
#: views/html/users/register.tpl:83 views/html/users/register.tpl:84
|
#: views/html/users/register.tpl:85 views/html/users/register.tpl:86
|
||||||
msgid "Username"
|
msgid "Username"
|
||||||
msgstr "Benutzername"
|
msgstr "Benutzername"
|
||||||
|
|
||||||
|
|
@ -1458,8 +1458,8 @@ msgstr "Benutzername"
|
||||||
#: views/html/introduction/index.tpl:8 views/html/users/create.tpl:92
|
#: views/html/introduction/index.tpl:8 views/html/users/create.tpl:92
|
||||||
#: views/html/users/create.tpl:93 views/html/users/edit.tpl:100
|
#: views/html/users/create.tpl:93 views/html/users/edit.tpl:100
|
||||||
#: views/html/users/edit.tpl:101 views/html/users/login.tpl:14
|
#: views/html/users/edit.tpl:101 views/html/users/login.tpl:14
|
||||||
#: views/html/users/login.tpl:15 views/html/users/register.tpl:91
|
#: views/html/users/login.tpl:15 views/html/users/register.tpl:93
|
||||||
#: views/html/users/register.tpl:92
|
#: views/html/users/register.tpl:94
|
||||||
msgid "Password"
|
msgid "Password"
|
||||||
msgstr "Passwort"
|
msgstr "Passwort"
|
||||||
|
|
||||||
|
|
@ -2031,7 +2031,7 @@ msgstr "Der Nachname ist ungültig"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:54 views/html/users/create.tpl:58
|
#: views/html/users/create.tpl:54 views/html/users/create.tpl:58
|
||||||
#: views/html/users/edit.tpl:58 views/html/users/edit.tpl:62
|
#: views/html/users/edit.tpl:58 views/html/users/edit.tpl:62
|
||||||
#: views/html/users/register.tpl:54 views/html/users/register.tpl:58
|
#: views/html/users/register.tpl:54 views/html/users/register.tpl:60
|
||||||
msgid "E‑mail address invalid"
|
msgid "E‑mail address invalid"
|
||||||
msgstr "Die E‑Mail-Adresse ist ungültig"
|
msgstr "Die E‑Mail-Adresse ist ungültig"
|
||||||
|
|
||||||
|
|
@ -2041,37 +2041,37 @@ msgid "E‑mail address already exists"
|
||||||
msgstr "E‑Mail-Adresse existiert bereits"
|
msgstr "E‑Mail-Adresse existiert bereits"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:63 views/html/users/edit.tpl:67
|
#: views/html/users/create.tpl:63 views/html/users/edit.tpl:67
|
||||||
#: views/html/users/register.tpl:63
|
#: views/html/users/register.tpl:65
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Password is too short (min. %d chars)"
|
msgid "Password is too short (min. %d chars)"
|
||||||
msgstr "Das Passwort ist zu kurz (min. %d Zeichen)"
|
msgstr "Das Passwort ist zu kurz (min. %d Zeichen)"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:65 views/html/users/edit.tpl:69
|
#: views/html/users/create.tpl:65 views/html/users/edit.tpl:69
|
||||||
#: views/html/users/register.tpl:65
|
#: views/html/users/register.tpl:67
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Password is too long (max. %d chars)"
|
msgid "Password is too long (max. %d chars)"
|
||||||
msgstr "Das Passwort ist zu lang (max. %d Zeichen)"
|
msgstr "Das Passwort ist zu lang (max. %d Zeichen)"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:67 views/html/users/edit.tpl:71
|
#: views/html/users/create.tpl:67 views/html/users/edit.tpl:71
|
||||||
#: views/html/users/register.tpl:67
|
#: views/html/users/register.tpl:69
|
||||||
msgid "Password invalid"
|
msgid "Password invalid"
|
||||||
msgstr "Das Passwort ist ungültig"
|
msgstr "Das Passwort ist ungültig"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:86 views/html/users/create.tpl:87
|
#: views/html/users/create.tpl:86 views/html/users/create.tpl:87
|
||||||
#: views/html/users/edit.tpl:94 views/html/users/edit.tpl:95
|
#: views/html/users/edit.tpl:94 views/html/users/edit.tpl:95
|
||||||
#: views/html/users/register.tpl:85 views/html/users/register.tpl:86
|
#: views/html/users/register.tpl:87 views/html/users/register.tpl:88
|
||||||
msgid "Prename"
|
msgid "Prename"
|
||||||
msgstr "Vorname"
|
msgstr "Vorname"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:88 views/html/users/create.tpl:89
|
#: views/html/users/create.tpl:88 views/html/users/create.tpl:89
|
||||||
#: views/html/users/edit.tpl:96 views/html/users/edit.tpl:97
|
#: views/html/users/edit.tpl:96 views/html/users/edit.tpl:97
|
||||||
#: views/html/users/register.tpl:87 views/html/users/register.tpl:88
|
#: views/html/users/register.tpl:89 views/html/users/register.tpl:90
|
||||||
msgid "Surname"
|
msgid "Surname"
|
||||||
msgstr "Nachname"
|
msgstr "Nachname"
|
||||||
|
|
||||||
#: views/html/users/create.tpl:90 views/html/users/create.tpl:91
|
#: views/html/users/create.tpl:90 views/html/users/create.tpl:91
|
||||||
#: views/html/users/edit.tpl:98 views/html/users/edit.tpl:99
|
#: views/html/users/edit.tpl:98 views/html/users/edit.tpl:99
|
||||||
#: views/html/users/register.tpl:89 views/html/users/register.tpl:90
|
#: views/html/users/register.tpl:91 views/html/users/register.tpl:92
|
||||||
#: views/html/users/user.tpl:24
|
#: views/html/users/user.tpl:24
|
||||||
msgid "E‑mail address"
|
msgid "E‑mail address"
|
||||||
msgstr "E‑Mail-Adresse"
|
msgstr "E‑Mail-Adresse"
|
||||||
|
|
@ -2109,7 +2109,12 @@ msgstr "Benutzer verwalten"
|
||||||
msgid "Registration"
|
msgid "Registration"
|
||||||
msgstr "Registrierung"
|
msgstr "Registrierung"
|
||||||
|
|
||||||
#: views/html/users/register.tpl:94
|
#: views/html/users/register.tpl:58
|
||||||
|
#, php-format
|
||||||
|
msgid "E‑Mail address has to end with @%s"
|
||||||
|
msgstr "Die E‑Mail-Adresse muss auf @%s enden"
|
||||||
|
|
||||||
|
#: views/html/users/register.tpl:96
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr "Registrieren"
|
msgstr "Registrieren"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@
|
||||||
case 'regex': echo _('E‑mail address invalid');
|
case 'regex': echo _('E‑mail address invalid');
|
||||||
break;
|
break;
|
||||||
case 'exist': echo _('E‑mail address already exists');
|
case 'exist': echo _('E‑mail address already exists');
|
||||||
|
break;
|
||||||
|
case 'host': printf(_('E‑Mail address has to end with @%s'), $emailhost);
|
||||||
break;
|
break;
|
||||||
default: echo _('E‑mail address invalid');
|
default: echo _('E‑mail address invalid');
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +89,7 @@
|
||||||
<label for="surname"><?=_('Surname')?>:</label>
|
<label for="surname"><?=_('Surname')?>:</label>
|
||||||
<input name="surname" type="text" placeholder="<?=_('Surname')?>" title="<?=_('Surname')?>" required="required" maxlength="<?=$validationSettings['surname']['maxlength']?>" value="<?=$surname?>" <?=(array_key_exists('surname', $validation)) ? 'class="invalid"' : null?> /><br />
|
<input name="surname" type="text" placeholder="<?=_('Surname')?>" title="<?=_('Surname')?>" required="required" maxlength="<?=$validationSettings['surname']['maxlength']?>" value="<?=$surname?>" <?=(array_key_exists('surname', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||||
<label for="email"><?=_('E‑mail address')?>:</label>
|
<label for="email"><?=_('E‑mail address')?>:</label>
|
||||||
<input name="email" type="email" placeholder="<?=_('E‑mail address')?>" title="<?=_('E‑mail address')?>" required="required" value="<?=$email?>" <?=(array_key_exists('email', $validation)) ? 'class="invalid"' : null?> /><br />
|
<input name="email" type="email" placeholder="<?=(!empty($emailhost)) ? '…@'.$emailhost : _('E‑mail address')?>" title="<?=_('E‑mail address')?>" required="required" value="<?=$email?>" <?=(array_key_exists('email', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||||
<label for="password"><?=_('Password')?>:</label>
|
<label for="password"><?=_('Password')?>:</label>
|
||||||
<input name="password" type="password" placeholder="<?=_('Password')?>" title="<?=_('Password')?>" required="required" maxlength="<?=$validationSettings['password']['maxlength']?>" <?=(array_key_exists('password', $validation)) ? 'class="invalid"' : null?> /><br />
|
<input name="password" type="password" placeholder="<?=_('Password')?>" title="<?=_('Password')?>" required="required" maxlength="<?=$validationSettings['password']['maxlength']?>" <?=(array_key_exists('password', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue