summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/lightweight-sca/hosting/server/htdocs/login/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/branches/lightweight-sca/hosting/server/htdocs/login/index.html')
-rw-r--r--sca-cpp/branches/lightweight-sca/hosting/server/htdocs/login/index.html337
1 files changed, 337 insertions, 0 deletions
diff --git a/sca-cpp/branches/lightweight-sca/hosting/server/htdocs/login/index.html b/sca-cpp/branches/lightweight-sca/hosting/server/htdocs/login/index.html
new file mode 100644
index 0000000000..bf09339927
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/hosting/server/htdocs/login/index.html
@@ -0,0 +1,337 @@
+<!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/"/>
+<script type="text/javascript">
+(function() {
+
+window.appcache = {};
+
+/**
+ * Get and cache a resource.
+ */
+appcache.get = function(uri) {
+ var h = uri.indexOf('#');
+ var u = h == -1? uri : uri.substring(0, h);
+
+ // Get resource from local storage first
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+
+ // Get resource from network
+ var http = new XMLHttpRequest();
+ http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
+ http.send(null);
+ if (http.status == 200) {
+ if (http.getResponseHeader("X-Login") != null) {
+ if (window.debug) debug('http error', u, 'X-Login');
+ return null;
+ } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
+ if (window.debug) debug('http error', u, 'No-Content');
+ return null;
+ }
+ try { ls.setItem(u, http.responseText); } catch(e) {}
+ return http.responseText;
+ }
+ if (window.debug) debug('http error', u, http.status, http.statusText);
+ return null;
+};
+
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
+(function() {
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+})();
+
+</script>
+</head>
+<body class="delayed"">
+<div id="mainbodydiv" class="bodydiv">
+
+<div id="headdiv" class="hsection">
+<script type="text/javascript">
+(function() {
+
+$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+
+})();
+</script>
+</div>
+
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
+
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed">
+<span class="cmenu">Sign in</span>
+</div>
+
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
+
+<br/>
+<form id="formSignin" name="formSignin" method="POST" action="/login/dologin" style="width: 100%;">
+<table style="width: 100%;">
+<tr><td><span id="loginprompt" style="font-size: 16px;"></span></tr></td>
+<tr><td><input type="text" class="flatentry" name="httpd_username" value="" placeholder="User id"/></td></tr>
+<tr><td><input type="password" class="flatentry" name="httpd_password" value="" placeholder="Password"/></td></tr>
+<tr><td><input type="submit" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" value="Sign in"/></td></tr>
+</table>
+<input type="hidden" name="httpd_location" value="/"/>
+</form>
+<br/>
+
+<form name="facebookOAuth2Form" style="width: 100%;">
+<table style="width: 100%;">
+<tr><td><span style="font-size: 16px;">Sign in with your <span style="font-weight: bold;">Facebook</span> account</span></td></tr>
+<tr><td><input type="button" id="facebookOAuth2Signin" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px"/></td></tr>
+</table>
+</form>
+<br/>
+
+<form name="googleOAuth2Form" style="width: 100%;">
+<table style="width: 100%;">
+<tr><td><span style="font-size: 16px;">Sign in with your <span style="font-weight: bold;" >Google</span> account</span></td></tr>
+<tr><td><input type="button" id="googleOAuth2Signin" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px"/></td></tr>
+</table>
+</form>
+<br/>
+
+<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>
+
+</div>
+</div>
+</div>
+
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="status" class="status fixed" style="visibility: hidden;"></div>
+
+<script type="text/javascript">
+(function() {
+
+/**
+ * Init div variables.
+ */
+var mbdiv = $('menubackground');
+var mdiv = $('menu');
+var hdiv = $('viewhead');
+var hbdiv = $('viewheadbackground');
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+$('loginprompt').innerHTML = config.loginprompt();
+var fdiv = $('viewfoot');
+
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Sign in';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+
+/**
+ * Build and show the menu bar.
+ */
+function showmenu(mdiv) {
+ mdiv.innerHTML = ui.menubar(mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+ fdiv.innerHTML = config.viewfoot();
+}
+
+showmenu(mdiv);
+
+/**
+ * Show a status message.
+ */
+window.showStatus = function(s, c) {
+ //debug('status', s);
+ var sdiv = $('status');
+ if (isNil(sdiv))
+ return s;
+ sdiv.innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+ sdiv.className = 'status fixed';
+ sdiv.style.visibility = 'visible';
+
+ function divtransitionend(e) {
+ e.target.style.visibility = 'hidden';
+ e.target.className = 'status fixed';
+ }
+ if (!sdiv.addedTransitionEnd) {
+ sdiv.addEventListener('webkitTransitionEnd', divtransitionend, false);
+ sdiv.addEventListener('transitionend', divtransitionend, false);
+ sdiv.addedTransitionEnd = true;
+ }
+ sdiv.className = 'statusout3 fixed';
+ return s;
+}
+
+/**
+ * Show an error message.
+ */
+window.showError = function(s) {
+ //debug('error', s);
+ return showStatus(s, 'errorstatus');
+}
+
+/**
+ * Parse the query parameeters.
+ */
+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;
+}
+
+/**
+ * Show login status.
+ */
+function showLoginStatus() {
+ var a = queryParams()['openauth_attempt'];
+ debug('a', a);
+ if (typeof(a) != 'undefined' && a == '1')
+ showError('Incorrect email or password, please try again');
+}
+
+showLoginStatus();
+
+/**
+ * Return the referrer URL.
+ */
+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 OAuth 2.0.
+ */
+function submitOAuth2Signin(w) {
+ parms = w();
+ clearauthcookie();
+ lstorage.removeItem('/r/Editor/accounts');
+ lstorage.removeItem('/r/Editor/dashboards');
+ 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 withGoogle() {
+ 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;
+}
+
+$('facebookOAuth2Signin').onclick = function() {
+ return submitOAuth2Signin(withFacebook);
+};
+
+$('googleOAuth2Signin').onclick = function() {
+ return submitOAuth2Signin(withGoogle);
+};
+
+/**
+ * Signin with a userid and password.
+ */
+function submitFormSignin() {
+ clearauthcookie();
+ document.formSignin.httpd_location.value = '/';
+ document.formSignin.submit();
+}
+
+$('formSignin').onsubmit = submitFormSignin;
+
+/**
+ * Handle orientation change.
+ */
+document.body.onorientationchange = function(e) {
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
+
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ return true;
+};
+
+/**
+ * Initialize the document.
+ */
+function onload() {
+ //debug('onload');
+ ui.onload();
+
+ // Show the page
+ document.body.style.visibility = 'visible';
+ return true;
+}
+
+onload();
+
+})();
+</script>
+
+</div>
+</body>
+</html>