source: extensions/oAuth/template/identification_common.tpl @ 23808

Last change on this file since 23808 was 23808, checked in by mistic100, 11 years ago

add Steam provider (OpenID based)

File size: 3.6 KB
RevLine 
[20620]1{combine_css path=$OAUTH_PATH|cat:'template/oauth_sprites.css'}
2
[20369]3{html_style}{literal}
[20293]4  #openid_form {
5    padding:20px;
6  }
[20620]7  #openid_form h3, #openid_form .oauth_38px {
[20293]8    display:inline-block;
9    vertical-align:middle;
10    margin:0;
11  }
[20324]12  #openid_label.error {
[20293]13    color:red;
14    font-weight:bold;
15  }
[20369]16{/literal}{/html_style}
[20293]17
18{combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
19{combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"}
20
[20369]21{footer_script}{literal}
[20293]22// redirect, called from the popup
[20369]23function redirect(type) {
24{/literal}
[20293]25  url = "{$REDIRECT_TO}";
26  if (typeof type != 'undefined' && type != 'default') {ldelim}
[20323]27    url = "{$ABS_ROOT_URL}"+ type +".php";
[20293]28  }
[20369]29{literal}
[20293]30  window.location.href = url;
31}
32
[20301]33// open authentication popup
[20369]34function open_auth(url) {
[20293]35  window.open(
36    url+ "&t=" + (new Date()).getTime(),
37    "hybridauth_social_sing_on",
[20323]38    "location=0,status=0,scrollbars=0,width=800,height=500"
[20293]39  ); 
40}
41
42// click on a button
[21584]43jQuery("a.oauth").click(function() {
44  var idp = jQuery(this).data('idp');
[20293]45 
[20369]46  switch(idp) {
[23808]47    case 'OpenID': case 'Wordpress': case 'Flickr': case 'Steam':
[20369]48      switch(idp) {
49{/literal}
[20301]50        case 'OpenID':
[21584]51          jQuery("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break;
[23808]52        case 'Wordpress': case 'Flickr': case 'Steam':
[21584]53          jQuery("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break;
[20293]54      }
[20369]55     
[21584]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);
[20369]60{literal} 
[21584]61      jQuery.colorbox({
[20293]62        inline:true,
63        href:"#openid_form",
64        initialWidth:0,
[20369]65        initialHeight:0,
[21584]66        onComplete:function(){ jQuery.colorbox.resize({speed:0}) } // prevent misalignement when icon not loaded
[20293]67      })
68      break;
69     
70    default:
[20369]71{/literal}
[20293]72      open_auth("{$OAUTH_URL}"+ idp);
[20369]73{literal}
[20293]74  }
75 
76  return false;
77});
78
[21584]79jQuery("#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('');
[20293]83 
[21584]84  jQuery("#openid_label").removeClass('error');
[20369]85  if (!oi) {
[21584]86    jQuery("#openid_label").addClass('error');
[20293]87    return false;
88  }
89 
[20369]90  switch(idp) {
[20293]91    case 'Wordpress': oi = "http://" + oi + ".wordpress.com"; break;
[20301]92    case 'Flickr': oi = "http://www.flickr.com/photos/" + oi + "/"; break;
[23808]93    case 'Steam': oi = "http://steamcommunity.com/openid/" + oi; break;
[20293]94  }
[20369]95{/literal} 
[20337]96  open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encodeURI(oi));
[20369]97{literal}
[21584]98  jQuery.colorbox.close();
[20293]99  return false;
100});
101
[21584]102jQuery("#openid_cancel").click(function() {
103  jQuery("#openid_label").removeClass('error');
104  jQuery.colorbox.close();
[20293]105  return false;
106});
[20369]107{/literal}{/footer_script}
[20293]108
109<div style="display:none;">
110  <form id="openid_form" action="">
111    <div>
[20620]112      <span class="oauth_38px"></span>
[20293]113      <h3>OpendID</h3>
114    </div>
115    <div>
[20323]116      <br>
[20293]117      <label id="openid_label" for="openid_identifier">Open ID URL</label>
118      <br>
119      <input type="text" name="openid_identifier" id="openid_identifier" size="50">
120    </div>
121    <div>
122      <br>
123      <input type="submit" name="{'Submit'|@translate}">
124      <a href="#" id="openid_cancel">{'Cancel'|@translate}</a>
125    </div>
126  </form>
127</div>
Note: See TracBrowser for help on using the repository browser.