Changeset 21584 for extensions/oAuth
- Timestamp:
- Mar 15, 2013, 6:43:07 PM (11 years ago)
- Location:
- extensions/oAuth
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/admin/providers.php
r20620 r21584 11 11 foreach ($_POST['providers'] as $id => $data) 12 12 { 13 $error = false;14 13 $data['enabled'] = $data['enabled']=='true'; 15 14 … … 21 20 ) { 22 21 array_push($page['errors'], sprintf(l10n('%s: invalid keys'), $PROVIDERS_CONFIG[$id]['provider_name'])); 23 $error = true;24 22 } 25 23 } 26 else27 {28 unset($data['keys']);29 }30 24 31 if ( ($id=='Wordpress' or $id=='Flickr') and $data['enabled'] and !@$providers['OpenID']['enabled'] ) 25 if ( ($id=='Wordpress' or $id=='Flickr') and $data['enabled'] and !@$providers['OpenID']['enabled'] ) // in the template, OpenID must be before other OpenID based providers 32 26 { 33 27 array_push($page['errors'], sprintf(l10n('OpenID must be enabled in order to use %s authentication'), $id)); 34 $error = true;35 28 } 36 29 -
extensions/oAuth/include/providers_stats.inc.php
r20368 r21584 7 7 'require_client_id' => true, 8 8 'new_app_link' => 'https://developers.facebook.com/apps', 9 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Facebook.html',10 9 'scope' => 'email', 11 10 ), … … 17 16 'require_client_id' => true, 18 17 'new_app_link' => 'https://code.google.com/apis/console', 19 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Google.html',20 18 'scope' => 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email', 21 19 ), … … 26 24 'require_client_id' => true, 27 25 'new_app_link' => 'http://instagram.com/developer/clients/manage', 28 'userguide_section' => null,29 26 ), 30 27 'LinkedIn' => array( … … 32 29 'provider_name' => 'LinkedIn', 33 30 'new_app_link' => 'https://www.linkedin.com/secure/developer', 34 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_LinkedIn.html',35 31 ), 36 32 'Tumblr' => array( … … 38 34 'provider_name' => 'Tumblr', 39 35 'new_app_link' => 'http://www.tumblr.com/oauth/apps', 40 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Tumblr.html',41 36 ), 42 37 'Twitter' => array( … … 44 39 'provider_name' => 'Twitter', 45 40 'new_app_link' => 'https://dev.twitter.com/apps', 46 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Twitter.html',47 41 ), 48 42 'Live' => array( … … 51 45 'require_client_id' => true, 52 46 'new_app_link' => 'https://manage.dev.live.com/ApplicationOverview.aspx', 53 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Live.html',54 47 ), 55 48 'Yahoo' => array( … … 57 50 'provider_name' => 'Yahoo!', 58 51 'new_app_link' => 'https://developer.apps.yahoo.com/projects/', 59 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Yahoo.html',60 52 ), 61 53 'OpenID' => array( … … 63 55 'provider_name' => 'OpenID', 64 56 'new_app_link' => null, 65 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_OpenID.html',66 57 ), 67 58 'Flickr' => array( … … 69 60 'provider_name' => 'Flickr', 70 61 'new_app_link' => null, 71 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_OpenID.html',72 62 ), 73 63 'Wordpress' => array( … … 75 65 'provider_name' => 'Wordpress', 76 66 'new_app_link' => null, 77 'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_OpenID.html',78 67 ), 79 68 ); -
extensions/oAuth/include/public_events.inc.php
r21325 r21584 61 61 $adapter = $hybridauth->authenticate($provider); 62 62 $remote_user = $adapter->getUserProfile(); 63 64 // security, check remote identifier 65 if ($remote_user->identifier != $user_identifier) 66 { 67 pwg_unset_session_var('oauth_new_user'); 68 throw new Exception('Hacking attempt!'); 69 } 63 70 64 71 $template->assign(array( … … 73 80 74 81 $oauth_id = $provider.'---'.$remote_user->identifier; 75 76 // security, check remote identifier77 if ($remote_user->identifier != $user_identifier)78 {79 pwg_unset_session_var('oauth_new_user');80 throw new Exception('Hacking attempt!');81 }82 82 83 83 // form submited … … 96 96 $user_id = get_userid($_POST['login']); 97 97 98 // u dpdate oauth field98 // update oauth field 99 99 $query = ' 100 100 UPDATE '.USERS_TABLE.' … … 235 235 $template->assign('REDIRECT_TO', get_gallery_home_url()); 236 236 237 $template->set_prefilter('menubar', 'oauth_add_menubar_buttons ');237 $template->set_prefilter('menubar', 'oauth_add_menubar_buttons_prefilter'); 238 238 } 239 239 … … 254 254 $add = 'disabled="disabled" '; 255 255 $script = ' 256 {footer_script} {literal}256 {footer_script} 257 257 jQuery("input[type=\'password\'], input[name=\'send_password_by_mail\']").parent("li").css("display", "none"); 258 {/ literal}{/footer_script}';258 {/footer_script}'; 259 259 260 260 $content = str_replace($search, $search.$add, $content); … … 269 269 } 270 270 271 function oauth_add_menubar_buttons ($content)271 function oauth_add_menubar_buttons_prefilter($content) 272 272 { 273 273 $search = '{include file=$block->template|@get_extent:$id }'; -
extensions/oAuth/template/identification_common.tpl
r20620 r21584 41 41 42 42 // click on a button 43 $("a.oauth").click(function() {44 var idp = $(this).data('idp');43 jQuery("a.oauth").click(function() { 44 var idp = jQuery(this).data('idp'); 45 45 46 46 switch(idp) { … … 49 49 {/literal} 50 50 case 'OpenID': 51 $("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break;51 jQuery("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break; 52 52 case 'Wordpress': case 'Flickr': 53 $("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break;53 jQuery("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break; 54 54 } 55 55 56 $("#openid_form").css('background-color', $("#the_page #content").css('background-color'));57 $("#openid_form .oauth_38px").removeClass().addClass("oauth_38px " + idp.toLowerCase());58 $("#openid_form h3").html(idp);59 $("#openid_form").data('idp', idp);56 jQuery("#openid_form").css('background-color', $("#the_page #content").css('background-color')); 57 jQuery("#openid_form .oauth_38px").removeClass().addClass("oauth_38px " + idp.toLowerCase()); 58 jQuery("#openid_form h3").html(idp); 59 jQuery("#openid_form").data('idp', idp); 60 60 {literal} 61 $.colorbox({61 jQuery.colorbox({ 62 62 inline:true, 63 63 href:"#openid_form", 64 64 initialWidth:0, 65 65 initialHeight:0, 66 onComplete:function(){ $.colorbox.resize({speed:0}) } // prevent misalignement when icon not loaded66 onComplete:function(){ jQuery.colorbox.resize({speed:0}) } // prevent misalignement when icon not loaded 67 67 }) 68 68 break; … … 77 77 }); 78 78 79 $("#openid_form").submit(function() {80 var idp = $(this).data('idp');81 var oi = $("#openid_form input[name='openid_identifier']").val();82 $("#openid_form input[name='openid_identifier']").val('');79 jQuery("#openid_form").submit(function() { 80 var idp = jQuery(this).data('idp'); 81 var oi = jQuery("#openid_form input[name='openid_identifier']").val(); 82 jQuery("#openid_form input[name='openid_identifier']").val(''); 83 83 84 $("#openid_label").removeClass('error');84 jQuery("#openid_label").removeClass('error'); 85 85 if (!oi) { 86 $("#openid_label").addClass('error');86 jQuery("#openid_label").addClass('error'); 87 87 return false; 88 88 } … … 95 95 open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encodeURI(oi)); 96 96 {literal} 97 $.colorbox.close();97 jQuery.colorbox.close(); 98 98 return false; 99 99 }); 100 100 101 $("#openid_cancel").click(function() {102 $("#openid_label").removeClass('error');103 $.colorbox.close();101 jQuery("#openid_cancel").click(function() { 102 jQuery("#openid_label").removeClass('error'); 103 jQuery.colorbox.close(); 104 104 return false; 105 105 }); -
extensions/oAuth/template/identification_menubar.tpl
r20620 r21584 1 {if $id == "mbIdentification" and isset($U_LOGIN) }1 {if $id == "mbIdentification" and isset($U_LOGIN) and count($PROVIDERS)} 2 2 {if not $OAUTH_JS_LOADED} 3 3 {assign var=OAUTH_JS_LOADED value=true} -
extensions/oAuth/template/identification_page.tpl
r20620 r21584 1 {if not $OAUTH_JS_LOADED} 2 {assign var=OAUTH_JS_LOADED value=true} 3 {include file=$OAUTH_ABS_PATH|cat:'template/identification_common.tpl'} 1 {if count($PROVIDERS)} 2 {if not $OAUTH_JS_LOADED} 3 {assign var=OAUTH_JS_LOADED value=true} 4 {include file=$OAUTH_ABS_PATH|cat:'template/identification_common.tpl'} 5 {/if} 6 {html_style}{literal} 7 #oauth_wrap .oauth { 8 margin:0 2px; 9 } 10 {/literal}{/html_style} 11 12 <fieldset style="text-align:center;" id="oauth_wrap"> 13 <legend>{'Or sign in with'|@translate}</legend> 14 15 {foreach from=$PROVIDERS item=provider key=p}{strip} 16 <a href="#" class="oauth oauth_{$oauth.identification_icon} {$p|strtolower}" data-idp="{$p}" title="{$provider.name}"></a> 17 {/strip}{/foreach} 18 </fieldset> 4 19 {/if} 5 {html_style}{literal}6 #oauth_wrap .oauth {7 margin:0 2px;8 }9 {/literal}{/html_style}10 11 <fieldset style="text-align:center;" id="oauth_wrap">12 <legend>{'Or sign in with'|@translate}</legend>13 14 {foreach from=$PROVIDERS item=provider key=p}{strip}15 <a href="#" class="oauth oauth_{$oauth.identification_icon} {$p|strtolower}" data-idp="{$p}" title="{$provider.name}"></a>16 {/strip}{/foreach}17 </fieldset>
Note: See TracChangeset
for help on using the changeset viewer.