Stepzhou has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/124129

Change subject: Allow users to associate Persona email to an existing account.
......................................................................

Allow users to associate Persona email to an existing account.

*   i18n updates
*   Added radio buttons and password field to login page
Bug: 63585

Change-Id: Ib6797483121c0e8848e64bfe165533f3f28a838a
---
M Persona.php
M SpecialPersonaSignup.php
M i18n/en.json
M i18n/qqq.json
4 files changed, 47 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Persona 
refs/changes/29/124129/1

diff --git a/Persona.php b/Persona.php
index 0efbdef..ca26ecd 100644
--- a/Persona.php
+++ b/Persona.php
@@ -21,7 +21,11 @@
        'path' => __FILE__,
        'name' => 'Persona',
        'version' => '0.6.0',
-       'author' => 'Tyler Romeo',
+       'author' => array(
+               'Tyler Romeo',
+               'Don Yu',
+               'Stephen Zhou',
+       ),
        'url' => 'https://www.mediawiki.org/wiki/Extension:Persona',
        'descriptionmsg' => 'persona-desc'
 );
diff --git a/SpecialPersonaSignup.php b/SpecialPersonaSignup.php
index 77ca4bb..2dc413b 100644
--- a/SpecialPersonaSignup.php
+++ b/SpecialPersonaSignup.php
@@ -64,6 +64,19 @@
                                'label-message' => 'persona-signup-name',
                                'required' => false,
                        ),
+                       'Question' => array(
+                               'type' => 'radio',
+                               'label-message' => 'persona-signup-question',
+                               'options-messages' => array(
+                                       'persona-signup-new-account' => 0,
+                                       'persona-signup-existing-account' => 1,
+                               ),
+                               'default' => 0,
+                       ),
+                       'Password' => array(
+                               'type' => 'password',
+                               'default' => '',
+                        ),
                        'CreateaccountToken' => array(
                                'type' => 'hidden',
                                'default' => LoginForm::getCreateaccountToken(),
@@ -72,16 +85,31 @@
        }
 
        function onSubmit( array $data ) {
-               global $wgRedirectOnLogin, $wgSecureLogin;
-
                $personaEmail = $this->getRequest()->getSessionData( 
'persona_email' );
+               $data['PersonaEmail'] = $personaEmail;
+
+               if ( $data['Question'] == 0 ) {
+                       $this->createAccount( $data );
+               }
+               else {
+                       $this->assoicateAccount( $data );
+               }
+
+               unset( $_SESSION['persona_email'] );
+
+               return true;
+       }
+
+       function createAccount( array $data ) {
+               global $wgSecureLogin;
+
                $context = new DerivativeContext( $this->getContext() );
                $context->setRequest( new DerivativeRequest(
                        $this->getContext()->getRequest(),
                        array(
                                'type' => 'signup',
                                'wpName' => $data['Name'],
-                               'wpEmail' => $personaEmail,
+                               'wpEmail' => $data['PersonaEmail'],
                                'wpRealName' => $data['RealName'],
                                'wpCreateaccountToken' => 
$data['CreateaccountToken'],
                                'wpCreateaccountMail' => true,
@@ -120,9 +148,10 @@
                }
 
                LoginForm::clearLoginToken();
-               unset( $_SESSION['persona_email'] );
+       }
 
-               return true;
+       function assoicateAccount( array $data ) {
+
        }
 
        function onSuccess() {
diff --git a/i18n/en.json b/i18n/en.json
index a2055be..36af32f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -14,5 +14,8 @@
     "persona-signup-password": "Password:",
     "persona-signup-name": "Name (optional):",
     "persona-signup-email": "Email address:",
-    "persona-signup-legend": "No account exists with this Persona e-mail 
address. Create an account here."
+    "persona-signup-legend": "No account exists with this Persona e-mail 
address. Create an account here.",
+    "persona-signup-question": "Do you have an existing account?",
+    "persona-signup-new-account": "No, I don't have an existing account",
+    "persona-signup-existing-account": "Yes, I have a password"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 6716879..a545e7b 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -17,5 +17,8 @@
     "persona-signup-username": "Signup username label for 
Special:Persona\n{{Identical|Username}}",
     "persona-signup-password": "Signup password label for 
Special:Persona\n{{Identical|Password}}",
     "persona-signup-name": "Signup real name label for Special:Persona",
-    "persona-signup-email": "Signup email address label for 
Special:Persona\n{{Identical|E-mail address}}"
+    "persona-signup-email": "Signup email address label for 
Special:Persona\n{{Identical|E-mail address}}",
+    "persona-signup-question": "Signup question asking user if user would like 
to tie Persona email with an account",
+    "persona-signup-new-account": "Signup button legend indicating user does 
not have an account",
+    "persona-signup-existing-account": "Signup button legend indicating user 
does have an account"
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/124129
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6797483121c0e8848e64bfe165533f3f28a838a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Persona
Gerrit-Branch: master
Gerrit-Owner: Stepzhou <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to