Stepzhou has uploaded a new change for review.

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

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

Allow useres to associate Persona email to an existing account.

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

Bug: 63585
Change-Id: I9f90716cd6419589a190766cac76669fe13b33e4
---
M Persona.i18n.php
M Persona.php
M SpecialPersonaSignup.php
3 files changed, 45 insertions(+), 6 deletions(-)


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

diff --git a/Persona.i18n.php b/Persona.i18n.php
index fa70713..dcf2e56 100644
--- a/Persona.i18n.php
+++ b/Persona.i18n.php
@@ -34,6 +34,9 @@
        '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-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',
 );
 
 /** Message documentation (Message documentation)
@@ -54,6 +57,9 @@
        'persona-signup-name' =>  'Signup real name label for Special:Persona',
        'persona-signup-email' => 'Signup email address label for 
Special:Persona',
        'personal-signup-legend' => 'Signup legend displayed when Persona 
e-mail is not tied with an existing account',
+       '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',
 );
 
 /** Asturian (asturianu)
diff --git a/Persona.php b/Persona.php
index e58acc8..85f03fd 100644
--- a/Persona.php
+++ b/Persona.php
@@ -22,7 +22,11 @@
        'path' => __FILE__,
        'name' => 'Persona',
        'version' => 0.5,
-       '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() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f90716cd6419589a190766cac76669fe13b33e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Persona
Gerrit-Branch: master
Gerrit-Owner: Stepzhou <step.z...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to