Allow changing nick on EmailRegistration

Nothing said that the EmailRegistration plugin was meant to restrict
the nickname to the local part of the email address. Let users change
it before they actually register the user.
This commit is contained in:
Mikael Nordfeldth 2015-03-01 12:31:52 +01:00
parent 746e658f3e
commit 7fdf2f50f4
2 changed files with 7 additions and 11 deletions

View File

@ -124,6 +124,7 @@ class EmailregisterAction extends Action
}
}
$this->nickname = Nickname::normalize($this->trimmed('nickname'));
$this->password1 = $this->trimmed('password1');
$this->password2 = $this->trimmed('password2');
@ -285,16 +286,13 @@ class EmailregisterAction extends Action
}
if (!empty($this->error)) {
$nickname = $this->nicknameFromEmail($email);
$this->form = new ConfirmRegistrationForm($this, $nickname, $email, $this->code);
$this->form = new ConfirmRegistrationForm($this, $this->nickname, $email, $this->code);
$this->showPage();
return;
}
$nickname = $this->nicknameFromEmail($email);
try {
$fields = array('nickname' => $nickname,
$fields = array('nickname' => $this->nickname,
'email' => $email,
'password' => $this->password1,
'email_confirmed' => true);
@ -305,8 +303,7 @@ class EmailregisterAction extends Action
$this->user = User::register($fields);
} catch (ClientException $e) {
$this->error = $e->getMessage();
$nickname = $this->nicknameFromEmail($email);
$this->form = new ConfirmRegistrationForm($this, $nickname, $email, $this->code);
$this->form = new ConfirmRegistrationForm($this, $this->nickname, $email, $this->code);
$this->showPage();
return;
}

View File

@ -71,12 +71,11 @@ class ConfirmRegistrationForm extends Form
$this->elementStart('li');
// TRANS: Field label in e-mail registration form.
$this->element('label', array('for' => 'nickname-ignore'), _m('LABEL','User name'));
$this->element('label', array('for' => 'nickname'), _m('LABEL','User name'));
$this->element('input', array('name' => 'nickname-ignore',
$this->element('input', array('name' => 'nickname',
'type' => 'text',
'id' => 'nickname-ignore',
'disabled' => 'true',
'id' => 'nickname',
'value' => $this->nickname));
$this->elementEnd('li');