From: Mikael Nordfeldth Date: Sun, 1 Mar 2015 11:31:52 +0000 (+0100) Subject: Allow changing nick on EmailRegistration X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7fdf2f50f458eaa10f00742c75b275f3cca0650d;p=quix0rs-gnu-social.git 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. --- diff --git a/plugins/EmailRegistration/actions/emailregister.php b/plugins/EmailRegistration/actions/emailregister.php index aa7f4d6ab6..7fa2aa22cf 100644 --- a/plugins/EmailRegistration/actions/emailregister.php +++ b/plugins/EmailRegistration/actions/emailregister.php @@ -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; } diff --git a/plugins/EmailRegistration/forms/confirmregistration.php b/plugins/EmailRegistration/forms/confirmregistration.php index 25e1bb0760..7618410e8e 100644 --- a/plugins/EmailRegistration/forms/confirmregistration.php +++ b/plugins/EmailRegistration/forms/confirmregistration.php @@ -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');