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

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

add Steam provider (OpenID based)

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