Commit 06652a1f3dd8c870af311ba186a3a353bb1e7a8e

Add oauth templates; Mistakenly not added in previous commit

  - Did not add oauth view's templates previously by mistake. Adding them now.
  
1{% extends "layout.html" %}
2{% block body %}
3<h4> Allow Access ?</h4>
4<p class="text-muted">
5 The following application wants to get permission to do stuff(?) on the <i>swt
6 web</i> platform on your behalf.
7</p>
8
9<form role="form" method="POST" action="{{ url_for('oauth.authorize') }}">
10 <div class="form-group">
11 <p class="form-control-static text-primary">
12 {{ client.name }} at {{ client.host_url }} wants
13 to get permission to post data to swt store
14 </p>
15 </div>
16 <div class="form-group">
17 <label class="control-label">Scopes</label>
18 <div class="">
19 <p class="form-control-static">{{ scopes|join(',') }}</p>
20 </div>
21 </div>
22 <input type="hidden" name="client_id" value="{{ client.id }}">
23 <input type="hidden" name="scope" value="{{ scopes|join(' ') }}">
24 <input type="hidden" name="response_type" value="{{ response_type }}">
25 {% if state %}
26 <input type="hidden" name="state" value="{{ state }}">
27 {% endif %}
28 <button type="submit" name="confirm" value="yes" class="btn btn-primary">Allow</button>
29 <button type="submit" name="confirm" value="no" class="btn btn-default">Deny</button>
30</form>
31
32{% endblock %}
33
34{% block scripts %}
35
36<script>
37 var created = new Date("{{ user.created }}");
38 window.onload = function() {
39 $('#user-created').html(created.toString());
40 };
41</script>
42
43{% endblock %}
  
1<body>
2<form id="authorized-form" role="form" method="POST" action="{{ url_for('oauth.authorize') }}">
3 <input type="hidden" name="client_id" value="{{ client.id }}">
4 <input type="hidden" name="scope" value="{{ scopes|join(' ') }}">
5 <input type="hidden" name="response_type" value="{{ response_type }}">
6 {% if state %}
7 <input type="hidden" name="state" value="{{ state }}">
8 {% endif %}
9 <!--button type="submit" name="confirm" value="yes" class="btn
10 btn-primary">Allow</button-->
11 <input type="hidden" name="confirm" value="yes">
12 <input type="hidden" name="authorized" value="yes">
13</form>
14
15<script>
16 window.onload = function() {
17 document.getElementById('authorized-form').submit();
18 };
19</script>
20</body>
  
1{% extends "layout.html" %}
2
3{% block scripts %}
4<script>
5 window.onload = function() {
6 navigator.id.watch({
7 loggedInUser: ss.loggedInUser(),
8 //when an user logs in
9 onlogin: function(assertion) {
10 //verify assertion and login the user
11 $.ajax({
12 type: 'POST',
13 url: ss.loginURL(),
14 data: {assertion: assertion},
15 success: function(data) {
16 console.log('successful login..', data);
17 window.location.reload();
18 },
19 error: function() {
20 navigator.id.logout();
21 }
22 });
23 },
24 onlogout: function() {
25 $.ajax({
26 type: 'POST',
27 url: ss.logoutURL(),
28 success: function() {
29 window.location.reload();
30 console.log('logged out');
31 },
32 error: function() {
33 }
34 });
35 }
36 });
37 navigator.id.request();
38 };
39</script>
40{% endblock %}