Changeset 26626 for extensions
- Timestamp:
- Jan 11, 2014, 3:50:26 PM (11 years ago)
- Location:
- extensions/oAuth
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/admin/config.php
r26556 r26626 8 8 'display_register' => isset($_POST['display_register']), 9 9 'display_menubar' => isset($_POST['display_menubar']), 10 'allow_merge_accounts' => isset($_POST['allow_merge_accounts']), 10 11 'identification_icon' => $_POST['identification_icon'], 11 12 'menubar_icon' => $_POST['menubar_icon'], -
extensions/oAuth/admin/template/config.tpl
r26558 r26626 20 20 <input type="checkbox" name="display_register" {if $display_register}checked="checked"{/if}> 21 21 <b>{'Display sign in buttons on the register page'|translate}</b> 22 </label> 23 </li> 24 25 <li> 26 <label> 27 <input type="checkbox" name="allow_merge_accounts" {if $allow_merge_accounts}checked="checked"{/if}> 28 <b>{'Allow users to merge existing account with new <i>Social Connect</i> identity'|translate}</b> 22 29 </label> 23 30 </li> -
extensions/oAuth/auth.php
r26619 r26626 33 33 { 34 34 header('HTTP/1.1 503 Service Unavailable'); 35 echo json_encode($response); 35 36 exit; 36 37 } -
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 } -
extensions/oAuth/language/en_UK/plugin.lang.php
r26608 r26626 28 28 $lang['Profile URL'] = 'Profile URL'; 29 29 $lang['Cancel'] = 'Cancel'; 30 $lang['Associate with an existing account'] = 'Associate with an existing account'; 31 $lang['Allow users to merge existing account with new <i>Social Connect</i> identity'] = 'Allow users to merge existing account with new <i>Social Connect</i> identity'; 30 32 31 33 ?> -
extensions/oAuth/language/fr_FR/plugin.lang.php
r26609 r26626 26 26 $lang['Logged with'] = 'Connecté avec'; 27 27 $lang['Profile URL'] = 'URL du profil'; 28 28 $lang['Associate with an existing account'] = 'Associer à un compte existant'; 29 $lang['Allow users to merge existing account with new <i>Social Connect</i> identity'] = 'Autoriser les utilisateur à fusionner un compte existant avec leur identité <i>Social Connect</i>'; 29 30 $lang['Cancel'] = 'Annuler'; 30 31 $lang['Please enter your user ID'] = 'Veuillez entrer votre ID d\'utilisateur'; -
extensions/oAuth/main.inc.php
r26619 r26626 66 66 function oauth_init() 67 67 { 68 global $conf, $page, $hybridauth_conf ;68 global $conf, $page, $hybridauth_conf, $template; 69 69 70 70 include_once(OAUTH_PATH . 'maintain.inc.php'); … … 90 90 91 91 // in case of registration aborded 92 // DON'T WORK, because potentially executed by sub-scripts like Secureimage for Crypto Captcha 93 // if ( script_basename() != 'register' and ($data=pwg_get_session_var('oauth_new_user')) !== null ) 94 // { 95 // pwg_unset_session_var('oauth_new_user'); 92 if ( script_basename() == 'index' and ($oauth_id=pwg_get_session_var('oauth_new_user')) !== null ) 93 { 94 pwg_unset_session_var('oauth_new_user'); 96 95 97 // require_once(OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php'); 98 99 // try { 100 // $hybridauth = new Hybrid_Auth($hybridauth_conf); 101 // $adapter = $hybridauth->getAdapter($data[0]); 102 // $adapter->logout(); 103 // } 104 // catch (Exception $e) { 105 // } 106 // } 96 if ($oauth_id[0] == 'Persona') 97 { 98 oauth_assign_template_vars(get_gallery_home_url()); 99 $template->block_footer_script(null, 'navigator.id.logout();'); 100 } 101 else 102 { 103 require_once(OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php'); 104 105 try { 106 $hybridauth = new Hybrid_Auth($hybridauth_conf); 107 $adapter = $hybridauth->getAdapter($oauth_id[0]); 108 $adapter->logout(); 109 } 110 catch (Exception $e) {} 111 } 112 } 107 113 } -
extensions/oAuth/maintain.inc.php
r26619 r26626 11 11 'identification_icon' => '38px', 12 12 'menubar_icon' => '26px', 13 'allow_merge_accounts' => true, 13 14 ); 14 15 … … 30 31 $conf['oauth'] = serialize($this->default_conf); 31 32 conf_update_param('oauth', $conf['oauth']); 33 } 34 else 35 { 36 $old_conf = is_string($conf['oauth']) ? unserialize($conf['oauth']) : $conf['oauth']; 37 38 if (!isset($old_conf['allow_merge_accounts'])) 39 { 40 $old_conf['allow_merge_accounts'] = true; 41 42 $conf['oauth'] = serialize($old_conf); 43 conf_update_param('oauth', $conf['oauth']); 44 } 32 45 } 33 46 … … 55 68 } 56 69 57 // add fields in hybridauth conf file70 // add 'total' and 'enabled' fields in hybridauth conf file 58 71 if (file_exists($this->file)) 59 72 {
Note: See TracChangeset
for help on using the changeset viewer.