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

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

fix OpenID

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