2 pagetitle = "Stemmaweb - Sign in"
3 applicationstyle = c.uri_for('/css/auth.css')
5 <script type="text/javascript">
6 $(document).ready(function() {
7 // call out to load the directory div
8 $('#login_actions').accordion();
9 $('.login_button').button();
10 $('#submit').button();
12 var status = '[% status_msg %]';
13 if( status == 'Logged in!' ) {
14 setInterval( function ( e ) {
15 window.opener.location.reload(true);
22 function googleSignIn(authResult) {
23 if (authResult['status']['signed_in']) {
24 document.getElementById('signinButton').setAttribute('style', 'display:none');
25 gapi.client.load('plus', 'v1', function apiClientLoaded() {
26 gapi.client.plus.people.get({ userId: 'me'}).execute(function infoRetrieved(resp) {
28 for (var i = 0; i < resp.emails.length; i++) {
29 if (resp.emails[i].type === 'account') {
30 primaryEmail = resp.emails[i].value;
34 dataRetrieved(authResult, primaryEmail);
38 console.log("Error", authResult);
42 function dataRetrieved(login, email) {
44 console.log(login.id_token);
46 document.getElementById('email').value = email;
47 document.getElementById('id_token').value = login.id_token;
48 document.getElementById('google_form').submit();
52 <script src="https://apis.google.com/js/client:platform.js" async defer></script>
55 <h1>Stemmaweb - Sign in</h1>
58 <div id="login_status">
60 <p>[% status_msg | html %]</p>
63 <p class="error">[% error_msg | html %]</p>
66 [% IF form.has_errors %]
67 <p class="error">Some fields had errors:</p>
70 [% FOREACH msg IN form.errors %]
71 <li>[% msg | html %]</li>
76 [% UNLESS status_msg == 'Logged in!' %]
77 <div id="login_actions">
78 <h3><a href="#">Sign in with Google</a></h3>
80 <p>If you have a Google account, you may use it to sign into Stemmaweb.</p>
81 <span id="signinButton">
84 data-callback="googleSignIn"
85 data-clientid="[% google_client_id %]"
86 data-cookiepolicy="single_host_origin"
87 data-requestvisibleactions="http://schema.org/AddAction"
88 data-scope="https://www.googleapis.com/auth/plus.profile.emails.read"
89 data-openidrealm="[% c.uri_for('/') %]"
93 <form id="google_form" action="[% c.uri_for_action('/users/login') | html %]" method="post">
94 <input id='email' name='email' value='' type='hidden' />
95 <input id='id_token' name='id_token' value='' type='hidden' />
99 <h3><a href="#">Sign in with OpenID</a></h3>
101 <p>If you have an account with an <a href="http://openid.net/get-an-openid/" target="_blank">OpenID provider</a> (e.g. WordPress, Blogger, Flickr, Yahoo), you may use it to sign into Stemmaweb.
102 <form class="openid_form" method="post" action="[% c.uri_for_action('/users/login') | html %]" autocomplete="off">
103 <input type="hidden" name="realm" value="openid"/>
104 <input type="text" name="openid_identifier" id="openid_input"/>
105 <input type="submit" class="login_button" id="login_openid" value="Sign in with OpenID"/>
109 [% UNLESS c.req.param('realm') == 'openid' %]
110 <h3><a href="#">Sign in with Stemmaweb</a></h3>
112 <p>If you do not have Google or another OpenID account, you may <a href="[% c.uri_for_action('/users/register') | html %]">register</a> for a user account here with its own password. Once you are registered, you can use this form to sign in.</p>
113 <form id="login_local_form" method="post" action="[% c.uri_for_action('/users/login') | html %]" autocomplete="off">
114 <input type="hidden" name="realm" value="default"/>
115 [% userlabel = form.field('username').label('Email address') %]
116 [% form.field('username').render %]
117 [% form.field('password').render %]
119 [% rememberlabel = form.field('remember').label('Remember me') %]
120 [% form.field('remember').render %]
122 [% submitbutton = form.field('submit').value('Sign in with Stemmaweb') %]
123 [% form.field('submit').render %]
129 [% PROCESS footer.tt %]