diff options
Diffstat (limited to 'sca-cpp/trunk/hosting/server/htdocs')
7 files changed, 77 insertions, 42 deletions
diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/index.html b/sca-cpp/trunk/hosting/server/htdocs/app/index.html index 0b01c1d3bd..19fa7488a5 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/app/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/app/index.html @@ -74,8 +74,12 @@ appcache.get = function(uri) { document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); })(); +</script> + +<script type="text/javascript"> + // Redirect to login page if not signed in -if (document.location.protocol == 'https:' && !ui.signedin()) +if (document.location.protocol == 'https:' && !hasauthcookie()) document.location = '/login/'; </script> diff --git a/sca-cpp/trunk/hosting/server/htdocs/index.html b/sca-cpp/trunk/hosting/server/htdocs/index.html index 3bc1529dbb..468461cedc 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/index.html @@ -74,8 +74,11 @@ appcache.get = function(uri) { document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); })(); +</script> +<script type="text/javascript"> + // Redirect to login page if not signed in -if (document.location.protocol == 'https:' && !ui.signedin()) +if (document.location.protocol == 'https:' && !hasauthcookie()) document.location = '/login/'; </script> @@ -260,7 +263,7 @@ function showmenu(mdiv, view, appname) { ui.menu(isNil(config.compose)? 'Composition' : config.compose, '/#view=graph&app=' + appname, '_view', view == 'graph'))), mklist( ui.menu('Account', '/#view=account', '_view', view == 'account'), - ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); + hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } /** @@ -434,8 +437,7 @@ window.onloginredirect = function(e) { */ function logout() { // Clear session cookie and user-specific local storage entries - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/login/index.html b/sca-cpp/trunk/hosting/server/htdocs/login/index.html index 9052abe8d3..359afc1807 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/login/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/login/index.html @@ -32,31 +32,50 @@ <h1>Sign in</h1> -<form name="openIDForm"> +<form name="googleOpenIDForm"> <table border="0"> -<tr><td><b>Sign in with your Google account</b></td></tr> -<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOpenIDSignin(withGoogle)"/></td></tr> +<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="oauth2Form"> +<form name="facebookOAuth2Form"> <table border="0"> -<tr><td><b>Sign in with your Facebook account</b></td></tr> -<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOAuth2Signin(withFacebook)"/></td></tr> +<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="/" method="GET"> -<input type="hidden" name="mod_oauth2_authorize" value=""/> -<input type="hidden" name="mod_oauth2_access_token" value=""/> -<input type="hidden" name="mod_oauth2_client_id" value=""/> -<input type="hidden" name="mod_oauth2_info" value=""/> -<input type="hidden" name="mod_oauth2_display" value=""/> -<input type="hidden" name="mod_oauth2_step" value="authorize"/> +<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"> @@ -85,8 +104,7 @@ function openauthReferrer() { * Signin with OpenID. */ function submitOpenIDSignin(w) { - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); @@ -95,7 +113,7 @@ function submitOpenIDSignin(w) { document.openIDSignin.submit(); } -function withGoogle() { +function withGoogleOpenID() { return 'https://www.google.com/accounts/o8/id'; } @@ -104,25 +122,40 @@ function withGoogle() { */ function submitOAuth2Signin(w) { parms = w(); - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); - document.oauth2Signin.mod_oauth2_authorize.value = parms[0]; - document.oauth2Signin.mod_oauth2_access_token.value = parms[1]; - document.oauth2Signin.mod_oauth2_client_id.value = parms[2]; - document.oauth2Signin.mod_oauth2_info.value = parms[3]; - document.oauth2Signin.mod_oauth2_display.value = parms[4]; - document.oauth2Signin.action = openauthReferrer(); + 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', ui.isMobile()? 'touch' : 'page']; + 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. */ diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html index 21f70f8a65..0c0435d8a7 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html @@ -110,7 +110,7 @@ var cdiv = $('content'); function showmenu(mdiv) { mdiv.innerHTML = ui.menubar( mklist(ui.menu('Home', '/', '_view', false)), - mklist(ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); + mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } showmenu(mdiv); @@ -121,8 +121,7 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); */ function logout() { // Clear session cookie and user-specific local storage entries - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html index 839cc3395b..0b364b1753 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html @@ -111,7 +111,7 @@ var cdiv = $('content'); function showmenu(mdiv) { mdiv.innerHTML = ui.menubar( mklist(ui.menu('Home', '/', '_view', false)), - mklist(ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); + mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } showmenu(mdiv); @@ -122,8 +122,7 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); */ function logout() { // Clear session cookie and user-specific local storage entries - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html index c014c7266e..11d25eedef 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html @@ -111,7 +111,7 @@ var cdiv = $('content'); function showmenu(mdiv) { mdiv.innerHTML = ui.menubar( mklist(ui.menu('Home', '/', '_view', false)), - mklist(ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); + mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } showmenu(mdiv); @@ -122,8 +122,7 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); */ function logout() { // Clear session cookie and user-specific local storage entries - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html index 2ef7754919..8d27c498d2 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html @@ -110,7 +110,7 @@ var cdiv = $('content'); function showmenu(mdiv) { mdiv.innerHTML = ui.menubar( mklist(ui.menu('Home', '/', '_view', false)), - mklist(ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); + mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } showmenu(mdiv); @@ -121,8 +121,7 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); */ function logout() { // Clear session cookie and user-specific local storage entries - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); |