]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/auth/signin.html
Closes OSQA 175 and OSQA 318. Added a bunch of options to configure the email validat...
[osqa.git] / forum / skins / default / templates / auth / signin.html
1 {% extends "base.html" %}\r
2 \r
3 {% load i18n %}\r
4 {% load extra_tags %}\r
5 \r
6 {% block title %}{% spaceless %}{% trans "Login" %}{% endspaceless %}{% endblock %}\r
7         \r
8 {% block forejs %}\r
9     <link rel="stylesheet" type="text/css" media="screen" href="{% media "/media/style/auth.css" %}"/>\r
10     {% for provider in all_providers %}\r
11         {% for location in provider.extra_css %}\r
12             <link rel="stylesheet" type="text/css" media="screen" href="{{ location }}"/>\r
13         {% endfor %}\r
14     {% endfor %}\r
15 {% endblock %}\r
16 \r
17 {% block content %}\r
18     {% for provider in all_providers %}\r
19         {% if provider.pre_code %}\r
20             {{ provider.pre_code|safe }}\r
21         {% endif %}\r
22     {% endfor %}\r
23     <div class="headNormal">\r
24             {% trans "User login" %}\r
25     </div>\r
26     {% if msg %}\r
27         <p class="error">{{ msg }}</p>\r
28     {% endif %}\r
29     {% for provider in top_stackitem_providers %}\r
30         <form class="signin_form" method="POST" action="{% url auth_provider_signin provider=provider.id %}" accept-charset="utf-8">\r
31             {% include provider.stack_item_template %}\r
32             <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
33         </form>\r
34     {% endfor %}\r
35     {% if top_stackitem_providers %}\r
36         <h3 class="or_label">{% trans 'Or...' %}</h3>\r
37     {% endif %}\r
38     <div style="width:600px;float:left;margin-bottom:5px;">\r
39     {% blocktrans %}\r
40         External login services use <b><a href="http://openid.net/">OpenID</a></b> technology, where your password always stays confidential between\r
41         you and your login provider and you don't have to remember another one.\r
42     {% endblocktrans %}\r
43     </div>\r
44     {% if request.user.is_anonymous %}\r
45         <div style="width:600px;float:left;margin-bottom:5px;">\r
46             <input type="checkbox" checked="checked" id="validate_email" />\r
47             {% trans "Validate my email after I login." %}\r
48         </div>\r
49     {% endif %}\r
50     <div id="bigicon_providers">\r
51         {% for provider in bigicon_providers %}\r
52             <div class="provider_logo big" name="{{ provider.id }}">\r
53                 <div class="inner">\r
54                     {% ifequal provider.type "DIRECT" %}\r
55                         <a class="provider_direct" href="{% url auth_provider_signin provider=provider.id %}">\r
56                             <img src="{% media provider.icon %}" />\r
57                         </a>\r
58                     {% endifequal %}\r
59                     {% ifequal provider.type "CUSTOM" %}\r
60                         {% include provider.code_template %}\r
61                     {% endifequal %}\r
62                     {% ifequal provider.type "SIMPLE_FORM" %}\r
63                         <img alt="{{ provider.simple_form_context.your_what }}" class="simple_form_provider" src="{% media provider.icon %}" />\r
64                     {% endifequal %}\r
65                 </div>\r
66             </div>\r
67         {% endfor %}\r
68     </div>\r
69     <div id="smallicon_providers">\r
70         {% for provider in smallicon_providers %}\r
71             <div class="provider_logo small" name="{{ provider.id }}">\r
72                 <div class="inner">\r
73                     {% ifequal provider.type "DIRECT" %}\r
74                         <a class="provider_direct" href="{% url auth_provider_signin provider=provider.id %}">\r
75                             <img src="{% media provider.icon %}" />\r
76                         </a>\r
77                     {% endifequal %}\r
78                     {% ifequal provider.type "CUSTOM" %}\r
79                         {% include provider.code_template %}\r
80                     {% endifequal %}\r
81                     {% ifequal provider.type "SIMPLE_FORM" %}\r
82                         <img alt="{{ provider.simple_form_context.your_what }}" class="simple_form_provider" src="{% media provider.icon %}" />\r
83                     {% endifequal %}\r
84                 </div>\r
85             </div>\r
86         {% endfor %}\r
87     </div>\r
88     <form name="signin_form" id="signin_form" class="signin_form" method="POST" action="">\r
89         <div id="signin_form_slot"></div>\r
90         <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
91     </form>\r
92     {% for provider in stackitem_providers %}\r
93         <h3 class="or_label">{% trans 'Or...' %}</h3>\r
94         <form class="signin_form" method="POST" action="{% url auth_provider_signin provider=provider.id %}" accept-charset="utf-8">\r
95             {% include provider.stack_item_template %}\r
96             <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
97         </form>\r
98     {% endfor %}\r
99     <h3 class="or_label">{% trans 'Or...' %}</h3>\r
100     <form name="signin_form" id="dummy_form_unused" class="signin_form" method="POST" action="">\r
101         <fieldset>\r
102             {% trans 'Click' %} <a href="{% url auth_request_tempsignin %}">{% trans 'here' %}</a> {% trans "if you're having troubles signing in." %}\r
103         </fieldset>\r
104     </form>\r
105     <script type="text/html" id="simple_form_template">\r
106         <fieldset id="slot_form">\r
107               <p id="provider_name_slot">{% trans 'Enter your ' %}%%YOUR_WHAT%%</p>\r
108               <div><p><span></span>\r
109                     <input id="input_field" type="text" name="input_field" /><span></span>\r
110                     <input id="ssignin" name="ssignin" type="submit" value="Login" />\r
111               </p></div>\r
112               <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
113           </fieldset>\r
114     </script>\r
115     <script type="text/javascript">\r
116         $(function() {\r
117             var signin_url = "{% url auth_provider_signin provider='PROVIDER' %}";\r
118 \r
119             function set_validate_email() {\r
120                 var validate = $('#validate_email').attr('checked') ? 'yes' : 'no';\r
121                 $('.validate_email').attr('value', validate);\r
122 \r
123                 $('.provider_direct').each(function() {\r
124                     var current_url = $(this).attr('href');\r
125                     if (!/\?validate_email\=(yes|no)$/.test(current_url)) {\r
126                         current_url += ('?validate_email=' + validate);\r
127                     } else {\r
128                         current_url = current_url.replace(/(yes|no)$/, validate);\r
129                     }\r
130 \r
131                     $(this).attr('href', current_url);\r
132                 })\r
133             }\r
134 \r
135             $('#validate_email').change(set_validate_email);\r
136 \r
137             function set_form_action(el) {\r
138                 var provider = el.parents('.provider_logo').attr('name');\r
139                 $('#signin_form').attr('action', signin_url.replace('PROVIDER', provider));\r
140             }\r
141 \r
142             $('.provider_logo').click(function() {\r
143                 $('.provider_logo').removeClass('selected');\r
144                 $(this).addClass('selected');\r
145             });\r
146 \r
147             $('.simple_form_provider').click(function() {\r
148                 $('#signin_form_slot').html('');\r
149                 var new_html = $('#simple_form_template').html()\r
150                     .replace('%%YOUR_WHAT%%', $(this).attr('alt'));\r
151                 $('#signin_form_slot').html(new_html);\r
152                 set_form_action($(this));\r
153                 set_validate_email();\r
154             })\r
155 \r
156             set_validate_email();\r
157         });\r
158     </script>\r
159 {% endblock %}\r
160 \r
161 {% block sidebar %}\r
162 <div class="boxC">\r
163     <h3 class="subtitle">{% trans "Why use OpenID?" %}</h3>\r
164     <ul class="list-item">\r
165         <li>\r
166                 {% trans "with openid it is easier" %}\r
167         </li>\r
168         <li>\r
169                 {% trans "reuse openid" %}\r
170         </li>\r
171         <li>\r
172                 {% trans "openid is widely adopted" %}\r
173         </li>\r
174         <li>\r
175                 {% trans "openid is supported open standard" %}\r
176         </li>\r
177 \r
178     </ul>\r
179     <p class="info-box-follow-up-links">\r
180         <a href="http://openid.net/what/" target="_blank">{% trans "Find out more" %} </a><br/>\r
181         <a href="http://openid.net/get/" target="_blank">{% trans "Get OpenID" %} </a>\r
182     </p>\r
183 </div>\r
184 {% endblock%}\r