[MediaWiki-commits] [Gerrit] Redirect to SpecialPage if nothing to do - change (mediawiki...GoogleLogin)

2014-06-27 Thread Florianschmidtwelzow (Code Review)
Florianschmidtwelzow has uploaded a new change for review.

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

Change subject: Redirect to SpecialPage if nothing to do
..

Redirect to SpecialPage if nothing to do

If the user logged into Google account and is already logged in with the
connected wiki user, don't show only the Unlink-Button, redirect to
Special:GoogleLogin.

Bug: 67186
Change-Id: I309b33c5bde3c3dd8c4b0b3674c23905de9a6ed7
---
M SpecialGoogleLogin.php
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GoogleLogin 
refs/changes/92/142492/1

diff --git a/SpecialGoogleLogin.php b/SpecialGoogleLogin.php
index 537aec6..c3461be 100644
--- a/SpecialGoogleLogin.php
+++ b/SpecialGoogleLogin.php
@@ -89,6 +89,7 @@
 */
private function createOrMerge( $userInfo, $db ) {
$out = $this-getOutput();
+   $request = $this-getRequest();
$user = $this-getUser();
$googleIdExists = $db-GoogleIdExists( $userInfo['id'] 
);
if ( !$googleIdExists ) {
@@ -102,7 +103,13 @@
if ( $user-getId() != 
$googleIdExists['id'] ) {
$out-addWikiMsg( 
'googlelogin-link-other' );
} else {
-   $this-GoogleUserForm( 'Unlink' 
);
+   if ( $request-getVal( 'code' ) 
!== null ) {
+   // if user logged into 
google account and is already logged in and linked, show the whole special 
page, not only a button
+   // bug 67486
+   $out-redirect( 
$this-getPageTitle()-getLocalUrl() );
+   } else {
+   $this-GoogleUserForm( 
'Unlink' );
+   }
}
} else {
$this-loginGoogleUser( 
$googleIdExists['id'] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I309b33c5bde3c3dd8c4b0b3674c23905de9a6ed7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GoogleLogin
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow florian.schmidt.wel...@t-online.de

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


[MediaWiki-commits] [Gerrit] Redirect to SpecialPage if nothing to do - change (mediawiki...GoogleLogin)

2014-06-27 Thread Florianschmidtwelzow (Code Review)
Florianschmidtwelzow has submitted this change and it was merged.

Change subject: Redirect to SpecialPage if nothing to do
..


Redirect to SpecialPage if nothing to do

If the user logged into Google account and is already logged in with the
connected wiki user, don't show only the Unlink-Button, redirect to
Special:GoogleLogin.

Bug: 67186
Change-Id: I309b33c5bde3c3dd8c4b0b3674c23905de9a6ed7
---
M SpecialGoogleLogin.php
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Florianschmidtwelzow: Verified; Looks good to me, approved



diff --git a/SpecialGoogleLogin.php b/SpecialGoogleLogin.php
index 537aec6..6972840 100644
--- a/SpecialGoogleLogin.php
+++ b/SpecialGoogleLogin.php
@@ -89,6 +89,7 @@
 */
private function createOrMerge( $userInfo, $db ) {
$out = $this-getOutput();
+   $request = $this-getRequest();
$user = $this-getUser();
$googleIdExists = $db-GoogleIdExists( $userInfo['id'] 
);
if ( !$googleIdExists ) {
@@ -102,7 +103,13 @@
if ( $user-getId() != 
$googleIdExists['id'] ) {
$out-addWikiMsg( 
'googlelogin-link-other' );
} else {
-   $this-GoogleUserForm( 'Unlink' 
);
+   if ( $request-getVal( 'code' ) 
!== null ) {
+   // if user logged into 
google account and is already logged in and linked,
+   // show the whole 
special page, not only a button - bug 67486
+   $out-redirect( 
$this-getPageTitle()-getLocalUrl() );
+   } else {
+   $this-GoogleUserForm( 
'Unlink' );
+   }
}
} else {
$this-loginGoogleUser( 
$googleIdExists['id'] );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I309b33c5bde3c3dd8c4b0b3674c23905de9a6ed7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GoogleLogin
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow florian.schmidt.wel...@t-online.de
Gerrit-Reviewer: Florianschmidtwelzow florian.schmidt.wel...@t-online.de

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