summaryrefslogtreecommitdiffstats
path: root/askbot/skins/default/templates/authopenid/signin.html
blob: 686068b03eb2a022bcf7bf1aea1e445f7c61a9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
{% extends "two_column_body.html" %}
<!-- signin.html -->
{% block title %}{% spaceless %}{% trans %}User login{% endtrans %}{% endspaceless %}{% endblock %}
{% block forestyle %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{"/jquery-openid/openid.css"|media}}"/>
{% endblock %}
{% block content %}
<h1>{{page_title}}</h1>
    {% if answer %}
        <div class="message">
        {% trans title=answer.question.title, summary=answer.summary %}
        Your answer to {{title}} {{summary}} will be posted once you log in
        {% endtrans %}
        </div>
    {% endif %}
    {% if question %}
        <div class="message">
        {% trans title=question.title, summary=question.summary %}Your question 
        {{title}} {{summary}} will be posted once you log in
        {% endtrans %}
        </div>
    {% endif %}
    <p id='login-intro'>
    {% if view_subtype == 'default' %}
        {% trans %}Take a pick of your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
    {% elif view_subtype == 'add_openid' %}
        {% if existing_login_methods %}
            {% trans %}It's a good idea to make sure that your existing login methods still work, or add a new one. Please click any of the icons below to check/change or add new login methods.{% endtrans %}
        {% else %}
            {% trans %}Please add a more permanent login method by clicking one of the icons below, to avoid logging in via email each time.{% endtrans %}
        {% endif %}
    {% elif view_subtype == 'change_openid' %}
        {% if existing_login_methods %}
            {% trans %}Click on one of the icons below to add a new login method or re-validate an existing one.{% endtrans %}
        {% else %}
            {% trans %}You don't have a method to log in right now, please add one or more by clicking any of the icons below.{% endtrans %}
        {% endif %}
    {% elif view_subtype == 'email_sent' %}
        {% trans %}Please check your email and visit the enclosed link to re-connect to your account{% endtrans %}
    {% endif %}
    </p>
    {% if openid_error_message %}
        <p class="warning">{{ openid_error_message }}</p>
    {% endif %}
    {% if view_subtype != 'email_sent' and view_subtype != 'bad_key' %}
        {# in this branch we display the login icons #}
        <form id="signin-form" method="post" action="{% url user_signin %}">
        {{login_form.login_provider_name}}
        <div id="login-icons">
            <ul class="login-icons large">
                {% for login_provider in major_login_providers %}
                <li>
                    <input
                        name="{{login_provider.name}}"
                        type="image"
                        class="{{login_provider.type}}"
                        src="{{login_provider.icon_media_path|media}}"
                        alt="{{login_provider.tooltip_text}}"
                        title="{{login_provider.tooltip_text}}"
                    />
                </li>
                {% endfor %}
            </ul>
            <ul class="login-icons small">
                {% for login_provider in minor_login_providers %}
                <li>
                    <input
                        name="{{login_provider.name}}"
                        type="image"
                        class="{{login_provider.type}}"
                        src="{{login_provider.icon_media_path|media}}"
                        alt="{{login_provider.tooltip_text}}"
                        title="{{login_provider.tooltip_text}}"
                    />
                </li>
                {% endfor %}
            </ul>
        </div>
        {{ login_form.next }}
        <fieldset 
            id="openid-fs" 
            {% if not login_form.openid_login_token.errors %}
                style="display:none;"
            {% endif %}
        >
            <h2 id="openid-heading">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
            <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
            <input type="text" name="openid_login_token" />
            <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
        </fieldset> 
        {% if use_password_login==True %}
        <fieldset 
            id="password-fs"
            {% if user.is_anonymous() %}
                {% if not login_form.username.errors and not login_form.password_login_failed %}
                    style="display:none;"
                {% endif %}
            {% else %}
                {% if not login_form.new_password.errors and not login_form.new_password_retyped.errors %}
                    style="display:none;"
                {% endif %}
            {% endif %}
        >
            {{login_form.password_action}}
            {% if user.is_anonymous() %}
                <h2 id="password-heading">
                    {% trans %}Please enter your <span>user name and password</span>, then sign in{% endtrans %}
                </h2>
                <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
                {% if login_form.password_login_failed %}
                    <p class="error">{% trans %}Login failed, please try again{% endtrans %}</p>
                {% endif %}
                <p>
                    <label for="id_username">{% trans %}Login name{% endtrans %}</label>
                    {{login_form.username}}
                </p>
                <p>
                    <label for="id_password">{% trans %}Password{% endtrans %}</label>
                    {{login_form.password}}
                </p>
                <p id="local_login_buttons">
                    <input class="submit-b" name="login_with_password" type="submit" value="{% trans %}Login{% endtrans %}" />
                    {% if settings.USE_LDAP_FOR_PASSWORD_LOGIN == False %}
                    <a class="create-password-account" style="vertical-align:middle" href="{% url user_signup_with_password %}">{% trans %}Create a password-protected account{% endtrans %}</a>
                    {% endif %}
                </p>
            {% elif settings.USE_LDAP_FOR_PASSWORD_LOGIN == False %}
                <h2 id="password-heading">
                    {% trans %}To change your password - please enter the new one twice, then submit{% endtrans %}
                </h2>
                <p>
                    <label for="id_new_password">{% trans %}New password{% endtrans %}</label>
                    {{login_form.new_password}}
                    <span class="error">{{login_form.new_password.errors[0]}}</span>
                </p>
                <p>
                    <label for="id_new_password_retyped">{% trans %}Please, retype{% endtrans %}</label>
                    {{login_form.new_password_retyped}}
                    <span class="error">{{login_form.new_password_retyped.errors[0]}}</span>
                </p>
                <p id="local_login_buttons">
                    <input class="submit-b" name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
                </p>
            {% endif %}
        </fieldset>
        {% endif %}
        </form>
        {% if user.is_authenticated() and existing_login_methods %}
        <div 
            id='existing-login-methods'
            {% if login_form.password_change_failed %}
                style="display:none";
            {% endif %}
        >
            <h2 id='ab-show-login-methods'>
                {% trans %}Here are your current login methods{% endtrans %}
            </h2>
            <table id='ab-existing-login-methods'>
                <tr>
                    <th>{% trans %}provider{% endtrans %}</th>
                    <th>{% trans %}last used{% endtrans %}</th>
                    <th>{% trans %}delete, if you like{% endtrans %}</th>
                </tr>
                {% for login_method in existing_login_methods %}
                <tr class="ab-provider-row">
                    <td class="ab-provider-name">
                        {{login_method.provider_name}}
                    </td>
                    <td>
                        {% if login_method.last_used_timestamp %}
                            {{login_method.last_used_timestamp|diff_date}}
                        {% endif %}
                    </td>
                    <td>
                        <button>{% trans %}delete{% endtrans %}</button>
                    </td>
                </tr>
                {% endfor %}
            </table>
        </div>
        {% endif %}
    {% endif %}
    {% if view_subtype != 'email_sent' or view_subtype == 'bad_key' %}
        {% if user.is_anonymous() %}
        <form id="account-recovery-form" action="{% url user_account_recover %}" method="post">
            {% if view_subtype != 'bad_key' %}
                <h2 id='account-recovery-heading'>{% trans %}Still have trouble signing in?{% endtrans %}</h2>
            {% endif %}
            <p class="hint">
                <span class="text">
                {% if view_subtype == 'bad_key' %}
                    {% trans %}Please, enter your email address below and obtain a new key{% endtrans %}
                {% else %}
                    {% trans %}Please, enter your email address below to recover your account{% endtrans %}
                {% endif %}
                </span>
                <span style="display:none" class="link"> - <a href="#">{% trans %}recover your account via email{% endtrans %}</a></span>
            </p>
            <fieldset id='email-input-fs'>
                {% if account_recovery_form.email.errors %}
                <p class="error">{{account_recovery_form.email.errors[0]}}</p>
                {% endif %}
                {{ account_recovery_form.email }}
                <input
                    class="submit-b"
                    type="submit"
                    {% if view_subtype == 'bad_key' %}
                    value="{% trans %}Send a new recovery key{% endtrans %}"
                    {% else %}
                    value="{% trans %}Recover your account via email{% endtrans %}"
                    {% endif %}
                />
            </fieldset>
        </form>
        {% endif %}
    {% endif %}
{% endblock %}

{% block sidebar %}
<div class="boxC">
    <h3 class="subtitle">{% trans %}Why use OpenID?{% endtrans %}</h3>
    <ul class="list-item">
        <li>
            {% trans %}with openid it is easier{% endtrans %}
        </li>
        <li>
            {% trans %}reuse openid{% endtrans %}
        </li>
        <li>
            {% trans %}openid is widely adopted{% endtrans %}
        </li>
        <li>
            {% trans %}openid is supported open standard{% endtrans %}
        </li>
    </ul>
    <p class="info-box-follow-up-links">
        <a href="http://openid.net/what/" target="_blank">{% trans %}Find out more{% endtrans %} »</a><br/>
        <a href="http://openid.net/get/" target="_blank">{% trans %}Get OpenID{% endtrans %} »</a>
    </p>
</div>
{% endblock%}
{% block endjs %}
    <script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script>
    <script type="text/javascript" src="{{"/jquery-openid/jquery.openid.js"|media}}"></script>
    <script type="text/javascript">
        var extra_token_name = {};
        var create_pw_text = {};
        var change_pw_text = {};
        var authUrl = '/{% trans %}account/{% endtrans %}';
        var siteName = '{{settings.APP_SHORT_NAME}}';
        var provider_count = {{existing_login_methods|length}};
        {% for login_provider in major_login_providers %}
            {% if login_provider.extra_token_name %}
                extra_token_name['{{login_provider.name}}'] = '{{login_provider.extra_token_name}}';
            {% endif %}
            {% if login_provider.type == 'password' %}
                create_pw_text['{{login_provider.name}}'] = '{{login_provider.create_password_prompt}}';
                change_pw_text['{{login_provider.name}}'] = '{{login_provider.change_password_prompt}}';
            {% endif %}
        {% endfor %}
        {% for login_provider in minor_login_providers %}
            {% if login_provider.extra_token_name %}
                extra_token_name['{{login_provider.name}}'] = '{{login_provider.extra_token_name}}';
            {% endif %}
            {% if login_provider.type == 'password' %}
                create_pw_text['{{login_provider.name}}'] = '{{login_provider.create_password_prompt}}';
                change_pw_text['{{login_provider.name}}'] = '{{login_provider.change_password_prompt}}';
            {% endif %}
        {% endfor %}
        {% if user.is_authenticated() %}
            var userIsAuthenticated = true;
        {% else %}
            var userIsAuthenticated = false;
        {% endif %}
        $("body").authenticator();
    </script>
    {% if settings.FACEBOOK_KEY and settings.FACEBOOK_SECRET %}
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
        $(document).ready(function(){
            if (typeof FB != 'undefined'){
                var ret = FB.init({appId: '{{settings.FACEBOOK_KEY}}', status: true, cookie: true, xfbml: true});
                FB.Event.subscribe('auth.sessionChange', function(response){
                        if (response.session) {
                        // A user has logged in, and a new cookie has been saved
                            $('#signin-form').submit();
                        } else {
                        // The user has logged out, and the cookie has been cleared
                        }
                });
            };
        });
    </script>
    {% endif %}
{% endblock %}
<!-- end signin.html -->