Changeset 26626 for extensions/oAuth/include/public_events.inc.php
- Timestamp:
- Jan 11, 2014, 3:50:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/include/public_events.inc.php
r26619 r26626 56 56 function oauth_begin_register() 57 57 { 58 global $conf, $template, $hybridauth_conf, $page ;58 global $conf, $template, $hybridauth_conf, $page, $user; 59 59 60 60 if ($hybridauth_conf['enabled'] == 0) … … 110 110 $page['infos'][] = l10n('Your registration is almost done, please complete the registration form.'); 111 111 112 // form submited112 // register form submited 113 113 if (isset($_POST['submit'])) 114 114 { … … 141 141 unset($_POST['submit']); 142 142 } 143 // login form submited 144 else if (isset($_POST['login']) && $conf['oauth']['allow_merge_accounts']) 145 { 146 if ($conf['insensitive_case_logon'] == true) 147 { 148 $_POST['username'] = search_case_username($_POST['username']); 149 } 150 151 if ( pwg_login(false, $_POST['username'], $_POST['password'], false) ) 152 { 153 pwg_unset_session_var('oauth_new_user'); 154 155 // update oauth field 156 $query = ' 157 UPDATE ' . USER_INFOS_TABLE . ' 158 SET oauth_id = "' . $oauth_id . '" 159 WHERE user_id = ' . $user['id'] . ' 160 ;'; 161 pwg_query($query); 162 163 redirect('profile.php'); 164 } 165 else 166 { 167 $page['errors'][] = l10n('Invalid password!'); 168 } 169 } 143 170 else 144 171 { … … 158 185 // template 159 186 $template->assign('OAUTH_PATH', OAUTH_PATH); 160 $template->set_prefilter('register', 'oauth_add_profile_prefilter'); 161 $template->set_prefilter('register', 'oauth_remove_password_fields_prefilter'); 187 if ($conf['oauth']['allow_merge_accounts']) 188 { 189 $template->assign('OAUTH_LOGIN_IN_REGISTER', true); 190 $template->set_prefilter('register', 'oauth_add_login_in_register'); 191 } 192 else 193 { 194 $template->set_prefilter('register', 'oauth_add_profile_prefilter'); 195 $template->set_prefilter('register', 'oauth_remove_password_fields_prefilter'); 196 } 162 197 } 163 198 catch (Exception $e) … … 335 370 return preg_replace($search, '$1 '.$add, $content); 336 371 } 372 373 function oauth_add_login_in_register($content) 374 { 375 $search[0] = '<form method="post" action="{$F_ACTION}"'; 376 $replace[0] = file_get_contents(OAUTH_PATH . 'template/register.tpl') . $search[0]; 377 378 $search[1] = '{\'Enter your personnal informations\'|@translate}'; 379 $replace[1] = '{\'Create a new account\'|@translate}'; 380 381 return str_replace($search, $replace, $content); 382 }
Note: See TracChangeset
for help on using the changeset viewer.