| Index: trunk/phase3/includes/SkinTemplate.php |
| — | — | @@ -586,6 +586,21 @@ |
| 587 | 587 | $loginlink = $wgUser->isAllowed( 'createaccount' ) |
| 588 | 588 | ? 'nav-login-createaccount' |
| 589 | 589 | : 'login'; |
| | 590 | + |
| | 591 | + # anonlogin & login are the same |
| | 592 | + $login_url = array( |
| | 593 | + 'text' => wfMsg( $loginlink ), |
| | 594 | + 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ), |
| | 595 | + 'active' => $title->isSpecial( 'Userlogin' ) |
| | 596 | + ); |
| | 597 | + global $wgProto, $wgSecureLogin; |
| | 598 | + if( $wgProto === 'http' && $wgSecureLogin ) { |
| | 599 | + $title = SpecialPage::getTitleFor( 'Userlogin' ); |
| | 600 | + $https_url = preg_replace( '/^http:/', 'https:', $title->getFullURL() ); |
| | 601 | + $login_url['href'] = $https_url; |
| | 602 | + $login_url['class'] = 'link-https'; # FIXME class depends on skin |
| | 603 | + } |
| | 604 | + |
| 590 | 605 | if( $this->showIPinHeader() ) { |
| 591 | 606 | $href = &$this->userpageUrlDetails['href']; |
| 592 | 607 | $personal_urls['anonuserpage'] = array( |
| — | — | @@ -602,17 +617,9 @@ |
| 603 | 618 | 'class' => $usertalkUrlDetails['exists'] ? false : 'new', |
| 604 | 619 | 'active' => ( $pageurl == $href ) |
| 605 | 620 | ); |
| 606 | | - $personal_urls['anonlogin'] = array( |
| 607 | | - 'text' => wfMsg( $loginlink ), |
| 608 | | - 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ), |
| 609 | | - 'active' => $title->isSpecial( 'Userlogin' ) |
| 610 | | - ); |
| | 621 | + $personal_urls['anonlogin'] = $login_url; |
| 611 | 622 | } else { |
| 612 | | - $personal_urls['login'] = array( |
| 613 | | - 'text' => wfMsg( $loginlink ), |
| 614 | | - 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ), |
| 615 | | - 'active' => $title->isSpecial( 'Userlogin' ) |
| 616 | | - ); |
| | 623 | + $personal_urls['login'] = $login_url; |
| 617 | 624 | } |
| 618 | 625 | } |
| 619 | 626 | |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -2954,6 +2954,19 @@ |
| 2955 | 2955 | */ |
| 2956 | 2956 | $wgAllowPrefChange = array(); |
| 2957 | 2957 | |
| | 2958 | +/** |
| | 2959 | + * This is to let user authenticate using https when they come from http. |
| | 2960 | + * Based on an idea by George Herbert on wikitech-l: |
| | 2961 | + * http://lists.wikimedia.org/pipermail/wikitech-l/2010-October/050065.html |
| | 2962 | + * @since 1.17 |
| | 2963 | + */ |
| | 2964 | +$wgSecureLogin = false; |
| | 2965 | +/** |
| | 2966 | + * Default for 'use secure login' checkbox |
| | 2967 | + * @since 1.17 |
| | 2968 | + */ |
| | 2969 | +$wgSecureLoginStickHTTPS = false; |
| | 2970 | + |
| 2958 | 2971 | /** @} */ # end user accounts } |
| 2959 | 2972 | |
| 2960 | 2973 | /************************************************************************//** |
| Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
| — | — | @@ -59,7 +59,7 @@ |
| 60 | 60 | var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted; |
| 61 | 61 | var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword; |
| 62 | 62 | var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage; |
| 63 | | - var $mSkipCookieCheck, $mReturnToQuery, $mToken; |
| | 63 | + var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS; |
| 64 | 64 | |
| 65 | 65 | private $mExtUser = null; |
| 66 | 66 | |
| — | — | @@ -89,6 +89,7 @@ |
| 90 | 90 | $this->mLoginattempt = $request->getCheck( 'wpLoginattempt' ); |
| 91 | 91 | $this->mAction = $request->getVal( 'action' ); |
| 92 | 92 | $this->mRemember = $request->getCheck( 'wpRemember' ); |
| | 93 | + $this->mStickHTTPS = $request->getCheck( 'wpStickHTTPS' ); |
| 93 | 94 | $this->mLanguage = $request->getText( 'uselang' ); |
| 94 | 95 | $this->mSkipCookieCheck = $request->getCheck( 'wpSkipCookieCheck' ); |
| 95 | 96 | $this->mToken = ( $this->mType == 'signup' ) ? $request->getVal( 'wpCreateaccountToken' ) : $request->getVal( 'wpLoginToken' ); |
| — | — | @@ -853,7 +854,12 @@ |
| 854 | 855 | if ( !$titleObj instanceof Title ) { |
| 855 | 856 | $titleObj = Title::newMainPage(); |
| 856 | 857 | } |
| 857 | | - $wgOut->redirect( $titleObj->getFullURL( $this->mReturnToQuery ) ); |
| | 858 | + $redirectUrl = $titleObj->getFullURL( $this->mReturnToQuery ); |
| | 859 | + global $wgSecureLogin; |
| | 860 | + if( $wgSecureLogin && !$this->mStickHTTPS ) { |
| | 861 | + $redirectUrl = preg_replace( '/^https:/', 'http:', $redirectUrl ); |
| | 862 | + } |
| | 863 | + $wgOut->redirect( $redirectUrl ); |
| 858 | 864 | } |
| 859 | 865 | } |
| 860 | 866 | |
| — | — | @@ -941,6 +947,7 @@ |
| 942 | 948 | global $wgUser, $wgOut, $wgHiddenPrefs, $wgEnableEmail; |
| 943 | 949 | global $wgRequest, $wgLoginLanguageSelector; |
| 944 | 950 | global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration; |
| | 951 | + global $wgSecureLogin, $wgSecureLoginStickHTTPS; |
| 945 | 952 | |
| 946 | 953 | $titleObj = SpecialPage::getTitleFor( 'Userlogin' ); |
| 947 | 954 | |
| — | — | @@ -1030,6 +1037,8 @@ |
| 1031 | 1038 | $template->set( 'canremember', ( $wgCookieExpiration > 0 ) ); |
| 1032 | 1039 | $template->set( 'usereason', $wgUser->isLoggedIn() ); |
| 1033 | 1040 | $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) || $this->mRemember ); |
| | 1041 | + $template->set( 'cansecurelogin', ( $wgSecureLogin === true ) ); |
| | 1042 | + $template->set( 'stickHTTPS', $this->mStickHTTPS ); |
| 1034 | 1043 | |
| 1035 | 1044 | if ( $this->mType == 'signup' ) { |
| 1036 | 1045 | if ( !self::getCreateaccountToken() ) { |
| Index: trunk/phase3/includes/templates/Userlogin.php |
| — | — | @@ -105,8 +105,24 @@ |
| 106 | 106 | </td> |
| 107 | 107 | </tr> |
| 108 | 108 | <?php } ?> |
| | 109 | +<?php if( $this->data['cansecurelogin'] ) { ?> |
| 109 | 110 | <tr> |
| 110 | 111 | <td></td> |
| | 112 | + <td class="mw-input"> |
| | 113 | + <?php |
| | 114 | + echo Xml::checkLabel( |
| | 115 | + wfMsg( 'securelogin-stick-https' ), |
| | 116 | + 'wpStickHTTPS', |
| | 117 | + 'wpStickHTTPS', |
| | 118 | + $this->data['stickHTTPS'], |
| | 119 | + array( 'tabindex' => '9' ) |
| | 120 | + ); |
| | 121 | + ?> |
| | 122 | + </td> |
| | 123 | + </tr> |
| | 124 | +<?php } ?> |
| | 125 | + <tr> |
| | 126 | + <td></td> |
| 111 | 127 | <td class="mw-submit"> |
| 112 | 128 | <?php |
| 113 | 129 | echo Html::input( 'wpLoginAttempt', wfMsg( 'login' ), 'submit', array( |
| Index: trunk/phase3/languages/messages/MessagesEn.php |
| — | — | @@ -1039,6 +1039,7 @@ |
| 1040 | 1040 | 'yourpassword' => 'Password:', |
| 1041 | 1041 | 'yourpasswordagain' => 'Retype password:', |
| 1042 | 1042 | 'remembermypassword' => 'Remember my login on this browser (for a maximum of $1 {{PLURAL:$1|day|days}})', |
| | 1043 | +'securelogin-stick-https' => 'Stay connected to HTTPS after login', |
| 1043 | 1044 | 'yourdomainname' => 'Your domain:', |
| 1044 | 1045 | 'externaldberror' => 'There was either an authentication database error or you are not allowed to update your external account.', |
| 1045 | 1046 | 'login' => 'Log in', |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -79,6 +79,7 @@ |
| 80 | 80 | to move LocalSettings.php |
| 81 | 81 | * The FailFunction "error handling" method has now been removed |
| 82 | 82 | * $wgAdditionalMailParams added to allow setting extra options to mail() calls. |
| | 83 | +* $wgSecureLogin & $wgSecureLoginStickHTTPS to optionaly login using HTTPS |
| 83 | 84 | |
| 84 | 85 | === New features in 1.17 === |
| 85 | 86 | * (bug 10183) Users can now add personal styles and scripts to all skins via |