]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow changing nick on EmailRegistration
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 1 Mar 2015 11:31:52 +0000 (12:31 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 1 Mar 2015 11:31:52 +0000 (12:31 +0100)
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.

plugins/EmailRegistration/actions/emailregister.php
plugins/EmailRegistration/forms/confirmregistration.php

index aa7f4d6ab6fc145ca1f29c6eeb6d63fa80180d5f..7fa2aa22cf2efe06d0eae3c0858fc8043606074c 100644 (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;
             }
index 25e1bb07603bd73c93418566c604e1f1ff804a7b..7618410e8ebf40ee20be939ef55b582020e80ac6 100644 (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');