Changeset 20369


Ignore:
Timestamp:
Jan 25, 2013, 12:26:05 PM (8 years ago)
Author:
mistic100
Message:

fix OpenID

Location:
extensions/oAuth
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/oAuth/include/hybridauth/Hybrid/Storage.php

    r20293 r20369  
    2828
    2929                if( $value ){
    30                         $_SESSION["HA::CONFIG"][$key] = $value;
     30                        $_SESSION["HA::CONFIG"][$key] = serialize($value);
    3131                }
    3232                elseif( isset( $_SESSION["HA::CONFIG"][$key] ) ){
    33                         return $_SESSION["HA::CONFIG"][$key]
     33                        return unserialize($_SESSION["HA::CONFIG"][$key])
    3434                }
    3535
     
    4242
    4343                if( isset( $_SESSION["HA::STORE"], $_SESSION["HA::STORE"][$key] ) ){
    44                         return $_SESSION["HA::STORE"][$key]
     44                        return unserialize($_SESSION["HA::STORE"][$key])
    4545                }
    4646
     
    5252                $key = strtolower( $key );
    5353
    54                 $_SESSION["HA::STORE"][$key] = $value;
     54                $_SESSION["HA::STORE"][$key] = serialize($value);
    5555        }
    5656
  • extensions/oAuth/main.inc.php

    r20337 r20369  
    117117 
    118118  // in case of registration aborded
    119   if (script_basename() != 'register')
     119  if ( script_basename() != 'register' and ($data=pwg_get_session_var('oauth_new_user')) !== null )
    120120  {
    121121    pwg_unset_session_var('oauth_new_user');
     122   
     123    require_once(OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php');
     124   
     125    try {
     126      $hybridauth = new Hybrid_Auth($hybridauth_conf);
     127      $adapter = $hybridauth->getAdapter($data[0]);
     128      $adapter->logout();
     129    }
     130    catch (Exception $e) {
     131    }
    122132  }
    123133}
  • extensions/oAuth/template/identification_common.tpl

    r20337 r20369  
    1 {html_head}{literal}
    2 <style type="text/css">
     1{html_style}{literal}
    32  #openid_form {
    43    padding:20px;
     
    1312    font-weight:bold;
    1413  }
    15 </style>
    16 {/literal}{/html_head}
     14{/literal}{/html_style}
    1715
    1816{combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
    1917{combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"}
    2018
    21 {footer_script}
     19{footer_script}{literal}
    2220// redirect, called from the popup
    23 function redirect(type) {ldelim}
     21function redirect(type) {
     22{/literal}
    2423  url = "{$REDIRECT_TO}";
    2524  if (typeof type != 'undefined' && type != 'default') {ldelim}
    2625    url = "{$ABS_ROOT_URL}"+ type +".php";
    2726  }
     27{literal}
    2828  window.location.href = url;
    2929}
    3030
    3131// open authentication popup
    32 function open_auth(url) {ldelim}
     32function open_auth(url) {
    3333  window.open(
    3434    url+ "&t=" + (new Date()).getTime(),
     
    3939
    4040// click on a button
    41 $("a.oauth").click(function() {ldelim}
     41$("a.oauth").click(function() {
    4242  var idp = $(this).attr('title');
    4343 
    44   switch(idp) {ldelim}
     44  switch(idp) {
    4545    case 'OpenID': case 'Wordpress': case 'Flickr':
    46       switch(idp) {ldelim}
     46      switch(idp) {
     47{/literal}
    4748        case 'OpenID':
    4849          $("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break;
     
    5051          $("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break;
    5152      }
    52  
     53     
    5354      $("#openid_form").css('background-color', $("#the_page #content").css('background-color'));
    5455      $("#openid_form img").attr('src', '{$ROOT_URL}{$OAUTH_PATH}template/icons/38px/'+ idp.toLowerCase() +'.png');
    5556      $("#openid_form h3").html(idp);
    5657      $("#openid_form").data('idp', idp);
    57      
    58       $.colorbox({ldelim}
     58{literal} 
     59      $.colorbox({
    5960        inline:true,
    6061        href:"#openid_form",
    6162        initialWidth:0,
    62         initialHeight:0
     63        initialHeight:0,
     64        onComplete:function(){ $.colorbox.resize({speed:0}) } // prevent misalignement when icon not loaded
    6365      })
    6466      break;
    6567     
    6668    default:
     69{/literal}
    6770      open_auth("{$OAUTH_URL}"+ idp);
     71{literal}
    6872  }
    6973 
     
    7175});
    7276
    73 $("#openid_form").submit(function() {ldelim}
     77$("#openid_form").submit(function() {
    7478  var idp = $(this).data('idp');
    7579  var oi = $("#openid_form input[name='openid_identifier']").val();
     
    7781 
    7882  $("#openid_label").removeClass('error');
    79   if (!oi) {ldelim}
     83  if (!oi) {
    8084    $("#openid_label").addClass('error');
    8185    return false;
    8286  }
    8387 
    84   switch(idp) {ldelim}
     88  switch(idp) {
    8589    case 'Wordpress': oi = "http://" + oi + ".wordpress.com"; break;
    8690    case 'Flickr': oi = "http://www.flickr.com/photos/" + oi + "/"; break;
    8791  }
    88  
     92{/literal} 
    8993  open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encodeURI(oi));
     94{literal}
    9095  $.colorbox.close();
    9196  return false;
    9297});
    9398
    94 $("#openid_cancel").click(function() {ldelim}
     99$("#openid_cancel").click(function() {
    95100  $("#openid_label").removeClass('error');
    96101  $.colorbox.close();
    97102  return false;
    98103});
    99 {/footer_script}
     104{/literal}{/footer_script}
    100105
    101106<div style="display:none;">
    102107  <form id="openid_form" action="">
    103108    <div>
    104       <img src="{$ROOT_URL}{$OAUTH_PATH}template/icons/openid_big.png">
     109      <img src="{$ROOT_URL}{$OAUTH_PATH}template/icons/openid_big.png" style="width:38px:height:38px;">
    105110      <h3>OpendID</h3>
    106111    </div>
  • extensions/oAuth/template/identification_menubar.tpl

    r20323 r20369  
    44    {include file=$OAUTH_ABS_PATH|@cat:'template/identification_common.tpl'}
    55  {/if}
    6   {html_head}{literal}
    7   <style type="text/css">
     6  {html_style}{literal}
    87    dl#mbIdentification dd:first-of-type {
    98      padding-bottom:0 !important;
     
    1211      margin:0 1px;
    1312    }
    14   </style>
    15   {/literal}{/html_head}
     13  {/literal}{/html_style}
    1614 
    1715  <dd>
  • extensions/oAuth/template/identification_page.tpl

    r20323 r20369  
    33  {include file=$OAUTH_ABS_PATH|@cat:'template/identification_common.tpl'}
    44{/if}
    5 {html_head}{literal}
    6 <style type="text/css">
     5{html_style}{literal}
    76  #oauth_wrap .oauth {
    87    margin:0 2px;
    98  }
    10 </style>
    11 {/literal}{/html_head}
     9{/literal}{/html_style}
    1210 
    1311<fieldset style="text-align:center;" id="oauth_wrap">
Note: See TracChangeset for help on using the changeset viewer.