server-share/web/0.3.4/auth.html

324 строки
8.3 KiB
HTML

<!DOCTYPE html>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (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.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Raindrop.
-
- The Initial Developer of the Original Code is
- Mozilla Messaging, Inc..
- Portions created by the Initial Developer are Copyright (C) 2009
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- -->
<html>
<head>
<title>Firefox Share OAuthorization</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script src="/0.3.4/scripts/requireplugins-jquery.js" charset="utf-8"></script>
<style>
html, body {
background-color: #fff;
height: 100%;
color: #0A0A0A;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 21px;
overflow: hidden;
}
.connecting {
margin-top: 60px;
text-align: center;
}
.connecting img {
vertical-align: middle;
}
.hidden {
display: none;
}
.invisible {
visibility: hidden;
}
#oauth {
background-color: #fff;
width: 100%;
position: absolute;
top: 50%;
left: 50%;
margin-left: -150px;
margin-top: -95px;
width: 300px;
background-image: url("/0.3.4/i/f1Logo.png");
background-position: center top;
background-repeat: no-repeat;
padding: 100px 0 0 0;
}
#oauth .text {
display: block;
margin: 0 0 7px 0;
}
#oauth .subtext {
margin-left: 7px;
color: #666666;
font-family: "Lucida Grande", Verdana, sans-serif;
font-size: 12px;
}
.controls {
width: 300px;
}
button {
height: 30px;
border-width: 1px 1px 1px 0;
border-style: solid;
border-color: #888;
cursor: pointer;
padding: 0 10px;
-moz-border-radius: 0 2px 2px 0;
-webkit-border-radius: 0 2px 2px 0;
border-radius: 0 2px 2px 0;
background-image: -moz-linear-gradient(center top , #fafafa 0%, #ddd 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fafafa), color-stop(100%, #ddd));
}
button:active {
-moz-box-shadow: 0 0 1px #666666 inset;
-webkit-box-shadow: 0 0 1px #666666 inset;
box-shadow: 0 0 1px #666666 inset;
background-image: -moz-linear-gradient(center top , #eee 0%, #ccc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eee), color-stop(100%, #ccc));
}
input {
border-width: 1px;
border-style: solid;
border-color: #888;
font-family: "Lucida Grande", Verdana, sans-serif;
font-size: 12px;
line-height: 18px;
padding: 3px;
margin: 0;
-moz-border-radius: 2px 0 0 2px;
-moz-box-shadow:0 3px 3px -3px rgba(0, 0, 0, 0.25) inset, 0 1px 0 #fff;
}
input:focus {
-moz-box-shadow: 0 0 0 3px rgba(0, 162, 255, 0.25) inset, 0 1px 0 #fff;
}
input.google {
background-image: url("/0.3.4/i/sprite.png");
background-position: 5px -159px;
background-repeat: no-repeat;
padding: 0 0 0 26px;
}
.hbox {
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: stretch;
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-align: stretch;
display: box;
box-orient: horizontal;
box-align: stretch;
}
.hbox > * {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
display: block;
}
.vbox {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-align: stretch;
display: -moz-box;
-moz-box-orient: vertical;
-moz-box-align: stretch;
display: box;
box-orient: vertical;
box-align: stretch;
}
.vbox > * {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
display: block;
}
.spacer {
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
}
.reverse {
-webkit-box-direction: reverse;
-moz-box-direction: reverse;
box-direction: reverse;
}
.boxFlex0 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
}
.boxFlex1, .boxFlex {
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
}
.boxFlex2 {
-webkit-box-flex: 2;
-moz-box-flex: 2;
box-flex: 2;
}
.boxGroup1 {
-webkit-box-flex-group: 1;
-moz-box-flex-group: 1;
box-flex-group: 1;
}
.boxGroup2 {
-webkit-box-flex-group: 2;
-moz-box-flex-group: 2;
box-flex-group: 2;
}
.start {
-webkit-box-pack: start;
-moz-box-pack: start;
box-pack: start;
}
.end {
-webkit-box-pack: end;
-moz-box-pack: end;
box-pack: end;
}
.center {
-webkit-box-pack: center;
-moz-box-pack: center;
box-pack: center;
}
</style>
<script>
require(["require", "jquery", "blade/url", "services", "jquery.cookie"],
function (require, $, url, services) {
var target = window.location.href.split('#')[1];
if (target && (target === 'oauth_success' || target === 'oauth_failure')) {
//TODO: ideally lock down the domain be location.hostname, but
//a problem for 127 addresses?
// XXX hacky way to handle fennec, since we didn't open a window,
// catch the exception when using window.opener and redirect
var data = {
target: target,
account: JSON.parse($.cookie("account_tokens"))
};
window.opener.postMessage(JSON.stringify(data), '*');
// clear the cookie, we no longer want it around
$.cookie("account_tokens", "", {"path": "/"});
window.close();
}
var search = window.location.href.split('?')[1];
if (search) {
search = search.split('#')[0];
var args = url.queryToObject(search),
domain = args.domain;
$(function () {
if (domain) {
// add a force login param to the form if asked.
if (args.forceLogin) {
var forceLogin = services.domains[domain].forceLogin;
if (forceLogin) {
$('<input type="hidden" name="' +
forceLogin.name +
'" value="' + forceLogin.value + '">').appendTo('[name="authForm"]');
}
}
$("#domain").attr("value", args['domain']);
if (args['domain'] == 'googleapps.com') {
// show UI for googleapp
$('#oauth').removeClass('hidden');
$('#message').addClass('hidden');
$('#submitbtn').click(function (evt) {
$('#oauth').addClass('hidden');
$('#message').removeClass('hidden');
document.authForm.submit();
});
} else {
document.authForm.submit();
}
}
});
}
});
</script>
</head>
<body class="settings">
<div id="oauth" class="authorize hidden">
<form name="authForm" action="/api/account/authorize" method="POST">
<input type="hidden" name="domain" id="domain" value="">
<span class="text">Enter your Google Apps domain</span>
<div class="controls hbox">
<input class="boxFlex google" name="openid_identifier" id="openid_identifier" value="">
<input class="boxFlex google" type="hidden" name="end_point_success" value="/0.3.4/auth.html#oauth_success">
<input class="boxFlex google" type="hidden" name="end_point_auth_failure" value="/0.3.4/auth.html#oauth_failure">
<button id='submitbtn' type="submit">submit</button>
</div>
<span class="subtext">ex: yourappdomain.com</span>
</form>
</div>
<div style="clear: both"/>
</div>
<div id='message' class="connecting"><img src="i/loader-w.gif"> connecting...</div>
</body>
</html>