Index: trunk/extensions/OpenID/OpenID.i18n.php |
— | — | @@ -102,6 +102,10 @@ |
103 | 103 | 'openiddelete-text' => 'By clicking the "{{int:openiddelete-button}}" button, you will remove the OpenID $1 from your account. |
104 | 104 | You will not be able anymore to login with this OpenID.', |
105 | 105 | 'openiddelete-button' => 'Confirm', |
| 106 | + 'openiddeleteerrornopassword' => 'You cannot delete all your OpenIDs because your account has no password. |
| 107 | +You would not able to log in without an OpenID.', |
| 108 | + 'openiddeleteerroropenidonly' => 'You cannot delete all your OpenIDs because your are only allowed to log in with OpenID. |
| 109 | +You would not able to log in without an OpenID.', |
106 | 110 | 'openiddelete-sucess' => 'The OpenID has been successfully removed from your account.', |
107 | 111 | 'openiddelete-error' => 'An error occured while removing the OpenID from your account.', |
108 | 112 | |
Index: trunk/extensions/OpenID/SpecialOpenIDConvert.body.php |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | } |
160 | 160 | |
161 | 161 | function delete() { |
162 | | - global $wgUser, $wgOut, $wgRequest; |
| 162 | + global $wgUser, $wgOut, $wgRequest, $wgOpenIDOnly; |
163 | 163 | |
164 | 164 | $openid = $wgRequest->getVal( 'url' ); |
165 | 165 | $user = self::getUser( $openid ); |
— | — | @@ -170,6 +170,18 @@ |
171 | 171 | |
172 | 172 | $wgOut->setPageTitle( wfMsg( 'openiddelete' ) ); |
173 | 173 | |
| 174 | + # Check if the user is removing it's last OpenID url |
| 175 | + $urls = self::getUserUrl( $wgUser ); |
| 176 | + if ( count( $urls ) == 1 ) { |
| 177 | + if ( $wgUser->mPassword == '' ) { |
| 178 | + $wgOut->showErrorPage( 'openiderror', 'openiddeleteerrornopassword' ); |
| 179 | + return; |
| 180 | + } elseif( $wgOpenIDOnly ) { |
| 181 | + $wgOut->showErrorPage( 'openiderror', 'openiddeleteerroropenidonly' ); |
| 182 | + return; |
| 183 | + } |
| 184 | + } |
| 185 | + |
174 | 186 | if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $openid ) ) { |
175 | 187 | $ret = self::removeUserUrl( $wgUser, $openid ); |
176 | 188 | $wgOut->addWikiMsg( $ret ? 'openiddelete-sucess' : 'openiddelete-error' ); |