Last modified: 2011-10-03 21:36:04 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33293, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31293 - check protocol in Special:UserLogin
check protocol in Special:UserLogin
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 20342
  Show dependency treegraph
 
Reported: 2011-10-01 12:12 UTC by Dr Brains
Modified: 2011-10-03 21:36 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dr Brains 2011-10-01 12:12:38 UTC
With the new 1.18 version, the magic word {{SERVER}} don't allow anymore to check protocol (http or https). 

But there is one place where it is needed : in [[MediaWiki:Loginend]], system message used in [[Special:Connexion]]. We have to check the protocol to provide the good message permitting to the user to go to "the other" protocol.

It appears that it is not possible with magic words/wikitext, and it is not possible either to "patch" with a javascript feature as JS is disabled in [[Special:Connexion]].

The only solution I've found is to check the protocol in PHP, and provide the system message [[MediaWiki:Loginend]] or [[MediaWiki:Loginend-secure]] (to be created) depending on the result.

The file to update is /includes/templates/Userlogin.php. The class "UserloginTemplate extends QuickTemplate", near the end, the folowing line :

<div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>

have to be replaced by something like that :

<div id="loginend"><?php 
if($PROTOCOL=="https"){
  $this->msgWiki( 'loginend-secure' ); 
}else{
  $this->msgWiki( 'loginend' ); 
}
?></div>


I don-t know exacty how to perform the ($PROTOCOL=="https") test, I assume that you'll get a solution...
Comment 1 Dr Brains 2011-10-01 12:18:57 UTC
Oups...

[[Special:Connexion]] is the french version of [[Special:UserLogin]].
Comment 2 Derk-Jan Hartman 2011-10-01 21:53:25 UTC
I like this solution. avoids introducing new keywords, which we would not want.
Comment 3 Derk-Jan Hartman 2011-10-02 20:21:21 UTC
r98708
Comment 4 Roan Kattouw 2011-10-02 20:22:52 UTC
(In reply to comment #0)
> <div id="loginend"><?php 
> if($PROTOCOL=="https"){
>   $this->msgWiki( 'loginend-secure' ); 
> }else{
>   $this->msgWiki( 'loginend' ); 
> }
> ?></div>
> 
Did this in r98707, thanks for the suggestion. I went with loginend-https instead of loginend-secure, though, and made it fall back to loginend if loginend-https doesn't exist.
Comment 5 Roan Kattouw 2011-10-02 20:23:12 UTC
And as pointed out by Derk-Jan, this fix is live on the cluster already.
Comment 6 Dr Brains 2011-10-02 20:37:23 UTC
It is not used (yet) in french Wikipedia, but perhaps the same change could be done with [[Mediawiki:signupend]] (used in [[Special:UserLogin]] with the "sign up" form (same php file, 2nd class)) ?
Comment 7 Dr Brains 2011-10-02 20:39:11 UTC
(And thank you for the quick answer for "loginend")
Comment 8 Roan Kattouw 2011-10-02 21:08:24 UTC
(In reply to comment #6)
> It is not used (yet) in french Wikipedia, but perhaps the same change could be
> done with [[Mediawiki:signupend]] (used in [[Special:UserLogin]] with the "sign
> up" form (same php file, 2nd class)) ?
Good point. Done in r98718.
Comment 9 Sergey Leschina 2011-10-03 16:23:13 UTC
You wrote:
$usingHTTPS = WebRequest::detectProtocol();
and next
if ( $usingHTTPS && ...) { ... }

I think you mean:
$usingHTTPS = WebRequest::detectProtocol() == 'https';

Now always shows loginend-https.
Comment 10 Roan Kattouw 2011-10-03 16:30:08 UTC
(In reply to comment #9)
> You wrote:
> $usingHTTPS = WebRequest::detectProtocol();
> and next
> if ( $usingHTTPS && ...) { ... }
> 
> I think you mean:
> $usingHTTPS = WebRequest::detectProtocol() == 'https';
> 
> Now always shows loginend-https.
Whoooops. I swear a previous incarnation of my code did have that. Fixed in r98774 and deployed.
Comment 11 Sergey Leschina 2011-10-03 18:20:08 UTC
One more problem: https://secure.wikimedia.org/ shows that it's unsecure.
Example: https://secure.wikimedia.org/wikipedia/ru/wiki/Special:UserLogin
Comment 12 Sergey Leschina 2011-10-03 18:31:47 UTC
Sorry, better example link: https://secure.wikimedia.org/wikipedia/ru/wiki/Special:UserLogin?uselang=ru
* "Обычная авторизация" (bold - selected) - basic auth
* "Безопасная авторизация" (unselected) - secure auth
Comment 13 Roan Kattouw 2011-10-03 21:36:04 UTC
(In reply to comment #11)
> One more problem: https://secure.wikimedia.org/ shows that it's unsecure.
> Example: https://secure.wikimedia.org/wikipedia/ru/wiki/Special:UserLogin
This is fixed now.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links