summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/hosting/server/htdocs/login/index.html
blob: 359afc18072caa37269930eb46e2d2b911c9b06a (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
<!DOCTYPE html>
<!--
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
-->
<html>
<head>
<title>Sign in</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/> 
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<base href="/login/"/>
<link rel="stylesheet" type="text/css" href="/ui-min.css"/>
<script type="text/javascript" src="/all-min.js"></script>
</head>
<body class="delayed" onload="onload();">
<div id="bodydiv" class="bodydiv">

<h1>Sign in</h1>

<form name="googleOpenIDForm">
<table border="0">
<tr><td><b>Sign in with your Google account (using OpenID)</b></td></tr>
<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOpenIDSignin(withGoogleOpenID)"/></td></tr>
</table>
</form>

<form name="facebookOAuth2Form">
<table border="0">
<tr><td><b>Sign in with your Facebook account (using OAuth)</b></td></tr>
<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOAuth2Signin(withFacebook)"/></td></tr>
</table>
</form>

<form name="googleOAuth2Form">
<table border="0">
<tr><td><b>Sign in with your Google account (using OAuth)</b></td></tr>
<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOAuth2Signin(withGoogleOAuth)"/></td></tr>
</table>
</form>

<form name="formSignin" method="POST" action="/login/dologin">
<table border="0">
<tr><td colspan="2"><b>Sign in with your user id and password</b></td></tr>
<tr><td>User id:</td><td><input type="text" name="httpd_username" value=""/></td></tr>
<tr><td>Password:</td><td><input type="password" name="httpd_password" value=""/></td></tr>
<tr><td><input type="button" class="graybutton" style="font-weight: bold;" onclick="submitFormSignin()" value="Sign in"/></td><td></td></tr>
</table>
</p>
<input type="hidden" name="httpd_location" value="/"/>
</form>

<form name="openIDSignin" action="/" method="GET">
<input type="hidden" name="openid_identifier" value=""/>
</form>

<form name="oauth2Signin" action="/oauth2/authorize/" method="GET">
<input type="hidden" name="oauth2_authorize" value=""/>
<input type="hidden" name="oauth2_access_token" value=""/>
<input type="hidden" name="oauth2_client_id" value=""/>
<input type="hidden" name="oauth2_info" value=""/>
<input type="hidden" name="oauth2_display" value=""/>
<input type="hidden" name="oauth2_scope" value=""/>
<input type="hidden" name="openauth_referrer" value=""/>
</form>

<script type="text/javascript">
function queryParams() {
    var qp = new Array();
    var qs = window.location.search.substring(1).split('&');
    for (var i = 0; i < qs.length; i++) {
        var e = qs[i].indexOf('=');
        if (e > 0)
            qp[qs[i].substring(0, e)] = unescape(qs[i].substring(e + 1));
    }
    return qp;
}

function openauthReferrer() {
    var r = queryParams()['openauth_referrer'];
    if (typeof(r) == 'undefined' || domainname(r) != domainname(window.location.hostname))
        return '/';
    var q = r.indexOf('?');
    if (q > 0)
        return r.substring(0, q);
    return r;
}

/**
 * Signin with OpenID.
 */
function submitOpenIDSignin(w) {
    clearauthcookie();
    localStorage.removeItem('/r/EditWidget/accounts');
    localStorage.removeItem('/r/EditWidget/dashboards');
    //localStorage.clear();
    document.openIDSignin.openid_identifier.value = w();
    document.openIDSignin.action = openauthReferrer();
    document.openIDSignin.submit();
}

function withGoogleOpenID() {
    return 'https://www.google.com/accounts/o8/id';
}

/**
 * Signin with OAuth 2.0.
 */
function submitOAuth2Signin(w) {
    parms = w();
    clearauthcookie();
    localStorage.removeItem('/r/EditWidget/accounts');
    localStorage.removeItem('/r/EditWidget/dashboards');
    //localStorage.clear();
    document.oauth2Signin.oauth2_authorize.value = parms[0];
    document.oauth2Signin.oauth2_access_token.value = parms[1];
    document.oauth2Signin.oauth2_client_id.value = parms[2];
    document.oauth2Signin.oauth2_info.value = parms[3];
    document.oauth2Signin.oauth2_scope.value = parms[4];
    document.oauth2Signin.oauth2_display.value = parms[5];
    document.oauth2Signin.openauth_referrer.value = openauthReferrer();
    document.oauth2Signin.action = '/oauth2/authorize/';
    document.oauth2Signin.submit();
}

function withFacebook() {
    var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'facebook.com', 'https://graph.facebook.com/me', 'email', ui.isMobile()? 'touch' : 'page'];
    return parms;
}

function withGoogleOAuth() {
    var parms = ['https://accounts.google.com/o/oauth2/auth', 'https://accounts.google.com/o/oauth2/token', 'google.com', 'https://www.googleapis.com/oauth2/v1/userinfo', 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile', ''];
    return parms;
}

/**
 * Signin with a userid and password.
 */
function submitFormSignin() {
    clearauthcookie();
    document.formSignin.httpd_location.value = '/';
    document.formSignin.submit();
}

/**
 * Handle orientation change.
 */
document.body.onorientationchange = function(e) {
    //log('onorientationchange');

    // Scroll to the top and hide the address bar
    window.scrollTo(0, 0);

    return true;
};

/**
 * Document load post processing.
 */
function onload() {
    //log('onload');

    // Show the page
    document.body.style.visibility = 'visible';

    // Scroll to the top and hide the address bar
    window.scrollTo(0, 0);
    return true;
}

</script>

</div>
</body>
</html>