Skip authentication for 3rd party login if email address is untouched
authorAlexander Ebert <ebert@woltlab.com>
Sun, 23 Jun 2013 19:30:07 +0000 (21:30 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 23 Jun 2013 19:30:07 +0000 (21:30 +0200)
wcfsetup/install/files/lib/form/RegisterForm.class.php

index 29645cb40d14e335d67fdcf1f5afbf746b88131a..3c74e982bdd2561c469838555f21f6ef60568a7b 100644 (file)
@@ -303,7 +303,9 @@ class RegisterForm extends UserAddForm {
                                WCF::getSession()->unregister('__githubData');
                                WCF::getSession()->unregister('__githubToken');
                                
-                               $registerVia3rdParty = true;
+                               if (WCF::getSession()->getVar('__email') && WCF::getSession()->getVar('__email') == $this->email) {
+                                       $registerVia3rdParty = true;
+                               }
                                
                                if (isset($githubData['bio'])) $saveOptions[User::getUserOptionID('aboutMe')] = $githubData['bio'];
                                if (isset($githubData['location'])) $saveOptions[User::getUserOptionID('location')] = $githubData['location'];
@@ -316,8 +318,6 @@ class RegisterForm extends UserAddForm {
                                
                                WCF::getSession()->unregister('__twitterData');
                                
-                               $registerVia3rdParty = true;
-                               
                                if (isset($twitterData['description'])) $saveOptions[User::getUserOptionID('aboutMe')] = $twitterData['description'];
                                if (isset($twitterData['location'])) $saveOptions[User::getUserOptionID('location')] = $twitterData['location'];
                        }
@@ -329,7 +329,9 @@ class RegisterForm extends UserAddForm {
                                
                                WCF::getSession()->unregister('__facebookData');
                                
-                               $registerVia3rdParty = true;
+                               if ($facebookData['email'] == $this->email) {
+                                       $registerVia3rdParty = true;
+                               }
                                
                                $saveOptions[User::getUserOptionID('gender')] = ($facebookData['gender'] == 'male' ? UserProfile::GENDER_MALE : UserProfile::GENDER_FEMALE);
                                
@@ -360,7 +362,9 @@ class RegisterForm extends UserAddForm {
                                
                                WCF::getSession()->unregister('__googleData');
                                
-                               $registerVia3rdParty = true;
+                               if (isset($googleData['email']) && $googleData['email'] == $this->email) {
+                                       $registerVia3rdParty = true;
+                               }
                                
                                switch ($googleData['gender']) {
                                        case 'male':