Wikinaut has uploaded a new change for review.

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


Change subject: redesigned Special:OpenIDLogin page uses 'disabled' input 
fields to show proposed account names
......................................................................

redesigned Special:OpenIDLogin page uses 'disabled' input fields to show 
proposed account names

Change-Id: Iefa470601ed1ad09e23621964219d577ba7ab3f6
---
M OpenID.i18n.php
M SpecialOpenIDLogin.body.php
2 files changed, 71 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenID 
refs/changes/69/95069/1

diff --git a/OpenID.i18n.php b/OpenID.i18n.php
index 509905f..fd56c96 100644
--- a/OpenID.i18n.php
+++ b/OpenID.i18n.php
@@ -86,11 +86,11 @@
        'openidchooselegend' => 'Username and account choice',
        'openidchooseinstructions' => 'All users need a nickname;
 you can choose one from the options below.',
-       'openidchoosenick' => 'Your nickname ($1)',
-       'openidchoosefull' => 'Your real name ($1)',
-       'openidchooseurl' => 'A name picked from your OpenID ($1)',
-       'openidchooseauto' => 'An auto-generated name ($1)',
-       'openidchoosemanual' => 'A name of your choice:',
+       'openidchoosenick' => 'your OpenID account "nickname"',
+       'openidchoosefull' => 'your OpenID account "fullname"',
+       'openidchooseurl' => 'name picked from your OpenID',
+       'openidchooseauto' => 'an auto-generated name',
+       'openidchoosemanual' => 'a name of your choice',
        'openidchooseexisting' => 'An existing account on this wiki',
        'openidchooseusername' => 'Username:',
        'openidchoosepassword' => 'Password:',
diff --git a/SpecialOpenIDLogin.body.php b/SpecialOpenIDLogin.body.php
index d290c82..2929041 100644
--- a/SpecialOpenIDLogin.body.php
+++ b/SpecialOpenIDLogin.body.php
@@ -303,7 +303,7 @@
                                                array(
                                                        'id' => 'wpExistingName'
                                                )
-                                       ) .
+                                       ) . ' ' .
                                        wfMessage( 'openidchoosepassword' 
)->text() .
                                        Xml::password( 'wpExistingPassword' ) .
                                        $oidAttributesUpdate
@@ -320,6 +320,7 @@
 
                                # These options won't exist if we can't get 
them.
                                if ( array_key_exists( 'nickname', $sreg ) && 
$this->userNameOK( $sreg['nickname'] ) ) {
+
                                        $wgOut->addHTML(
                                                Xml::openElement( 'tr' ) .
                                                Xml::tags( 'td',
@@ -338,10 +339,19 @@
                                                        array(
                                                                'class' => 
'mw-input'
                                                        ),
-                                                       Xml::label( wfMessage( 
'openidchoosenick', $sreg['nickname'] )->escaped(), 'wpNameChoiceNick' )
+                                                       Xml::input( 
'wpNameValue',
+                                                               16,
+                                                               
htmlspecialchars( $sreg['nickname'], ENT_QUOTES ),
+                                                               array(
+                                                                       'id' => 
'wpNameValue',
+                                                                       
'disabled' => 'disabled'
+                                                               )
+                                                       ) .
+                                                       Xml::label( ' ' . 
wfMessage( 'openidchoosenick' )->text(), 'wpNameChoiceNick' )
                                                ) .
                                                Xml::closeElement( 'tr' )
                                        );
+
                                }
 
                                # These options won't exist if we can't get 
them.
@@ -356,6 +366,7 @@
                                }
 
                                if ( $fullname && $this->userNameOK( $fullname 
) ) {
+
                                        $wgOut->addHTML(
                                                Xml::openElement( 'tr' ) .
                                                Xml::tags( 'td',
@@ -374,15 +385,25 @@
                                                        array(
                                                                'class' => 
'mw-input'
                                                        ),
-                                                       Xml::label( wfMessage( 
'openidchoosefull', $fullname )->escaped(), 'wpNameChoiceFull' )
+                                                       Xml::input( 
'wpNameValue',
+                                                               16,
+                                                               
htmlspecialchars( $fullname, ENT_QUOTES ),
+                                                               array(
+                                                                       'id' => 
'wpNameValue',
+                                                                       
'disabled' => 'disabled'
+                                                               )
+                                                       ) .
+                                                       Xml::label( ' ' . 
wfMessage( 'openidchoosefull' )->text(), 'wpNameChoiceFull' )
                                                ) .
                                                Xml::closeElement( 'tr' )
                                        );
                                        $def = true;
+
                                }
 
                                $idname = $this->toUserName( $openid );
                                if ( $idname && $this->userNameOK( $idname ) ) {
+
                                        $wgOut->addHTML(
                                                Xml::openElement( 'tr' ) .
                                                Xml::tags( 'td',
@@ -401,15 +422,25 @@
                                                        array(
                                                                'class' => 
'mw-input'
                                                        ),
-                                                       Xml::label( wfMessage( 
'openidchooseurl', $idname )->text(), 'wpNameChoiceUrl' )
+                                                       Xml::input( 
'wpNameValue',
+                                                               16,
+                                                               
htmlspecialchars( $idname, ENT_QUOTES ),
+                                                               array(
+                                                                       'id' => 
'wpNameValue',
+                                                                       
'disabled' => 'disabled'
+                                                               )
+                                                       ) .
+                                                       Xml::label( ' ' . 
wfMessage( 'openidchooseurl' )->text(), 'wpNameChoiceUrl' )
                                                ) .
                                                Xml::closeElement( 'tr' )
                                        );
                                        $def = true;
                                }
+
                        } // if $wgOpenIDProposeUsernameFromSREG
 
                        if ( $wgOpenIDAllowAutomaticUsername ) {
+
                                $wgOut->addHTML(
                                        Xml::openElement( 'tr' ) .
                                        Xml::tags( 'td',
@@ -428,13 +459,23 @@
                                                array(
                                                        'class' => 'mw-input'
                                                ),
-                                               Xml::label( wfMessage( 
'openidchooseauto', $this->automaticName( $sreg ) )->escaped(), 
'wpNameChoiceAuto' )
+                                               Xml::input( 'wpNameValue',
+                                                       16,
+                                                       htmlspecialchars( 
$this->automaticName( $sreg ), ENT_QUOTES ),
+                                                       array(
+                                                               'disabled' => 
'disabled',
+                                                               'id' => 
'wpNameValue'
+                                                       )
+                                               ) .
+                                               Xml::label( ' ' . wfMessage( 
'openidchooseauto' )->text(), 'wpNameChoiceAuto' )
                                        ) .
                                        Xml::closeElement( 'tr' )
                                        );
+
                        }
 
                        if ( $wgOpenIDAllowNewAccountname ) {
+
                                $wgOut->addHTML(
 
                                Xml::openElement( 'tr' ) .
@@ -454,17 +495,18 @@
                                        array(
                                                'class' => 'mw-input'
                                        ),
-                                       Xml::label( wfMessage( 
'openidchoosemanual' )->text(), 'wpNameChoiceManual' ) . ' ' .
                                        Xml::input( 'wpNameValue',
                                                16,
                                                false,
                                                array(
                                                        'id' => 'wpNameValue'
                                                )
-                                       )
+                                       ) .
+                                       Xml::label( ' ' . wfMessage( 
'openidchoosemanual' )->text(), 'wpNameChoiceManual' )
                                ) .
                                Xml::closeElement( 'tr' )
                                );
+
                        }
 
                } // These are only available if all visitors are allowed to 
create accounts
@@ -523,6 +565,7 @@
                $nameValue = $wgRequest->getText( 'wpNameValue' );
 
                if ( $choice == 'existing' ) {
+
                        $user = $this->attachUser( $openid, $sreg,
                                $wgRequest->getText( 'wpExistingName' ),
                                $wgRequest->getText( 'wpExistingPassword' )
@@ -543,22 +586,27 @@
                        $this->updateUser( $user, $sreg, $ax );
 
                } else {
+
                        $name = $this->getUserName( $openid, $sreg, $ax, 
$choice, $nameValue );
 
                        if ( !$name || !$this->userNameOK( $name ) ) {
+
                                wfDebug( "OpenID: Name not OK: '$name'\n" );
                                $this->chooseNameForm( $openid, $sreg, $ax );
                                return;
+
                        }
 
                        $user = $this->createUser( $openid, $sreg, $ax, $name );
                }
 
                if ( is_null( $user ) ) {
+
                        wfDebug( "OpenID: aborting in ChooseName because we 
could not create user object\n" );
                        $this->clearValues();
                        $wgOut->showErrorPage( 'openiderror', 'openiderrortext' 
);
                        return;
+
                }
 
                $wgUser = $user;
@@ -586,15 +634,18 @@
                }
 
                switch ( $response->status ) {
+
                case Auth_OpenID_CANCEL:
                        // This means the authentication was cancelled.
                        $wgOut->showErrorPage( 'openidcancel', 
'openidcanceltext' );
                        break;
+
                case Auth_OpenID_FAILURE:
                        wfDebug( "OpenID: error message '" . $response->message 
. "'\n" );
                        $wgOut->showErrorPage( 'openidfailure', 
'openidfailuretext',
                                array( ( $response->message ) ? 
$response->message : '' ) );
                        break;
+
                case Auth_OpenID_SUCCESS:
                        // This means the authentication succeeded.
                        wfSuppressWarnings();
@@ -618,18 +669,23 @@
                        wfRestoreWarnings();
 
                        if ( is_null( $openid ) ) {
+
                                wfDebug( "OpenID: aborting in auth success 
because identity URL is missing\n" );
                                $wgOut->showErrorPage( 'openiderror', 
'openiderrortext' );
                                return;
+
                        }
 
                        $user = self::getUserFromUrl( $openid );
 
                        if ( $user instanceof User ) {
+
                                $this->updateUser( $user, $sreg, $ax ); # 
update from server
                                $wgUser = $user;
                                $this->displaySuccessLogin( $openid );
+
                        } else {
+
                                // if we are hardcoding nickname, and a valid 
e-mail address was returned, create a user with this name
                                if ( $wgOpenIDUseEmailAsNickname ) {
                                        $name = $this->getNameFromEmail( 
$openid, $sreg, $ax );
@@ -643,8 +699,11 @@
                                $this->saveValues( $openid, $sreg, $ax );
                                $this->chooseNameForm( $openid, $sreg, $ax );
                                return;
+
                        }
+
                }
+
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefa470601ed1ad09e23621964219d577ba7ab3f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenID
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to