Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / google_apis / test / service_login.html
blobd60570782e5731c8384ebd151fece8646b499e5a
1 <HTML>
2 <HEAD>
3 <SCRIPT>
4 var gaia = gaia || {};
5 gaia.chromeOSLogin = {};
7 gaia.chromeOSLogin.parent_page_url_ =
8 'chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html';
10 gaia.chromeOSLogin.attemptLogin = function(email, password, attemptToken) {
11 var msg = {
12 'method': 'attemptLogin',
13 'email': email,
14 'password': password,
15 'attemptToken': attemptToken
17 window.parent.postMessage(msg, gaia.chromeOSLogin.parent_page_url_);
20 gaia.chromeOSLogin.clearOldAttempts = function() {
21 var msg = {
22 'method': 'clearOldAttempts'
24 window.parent.postMessage(msg, gaia.chromeOSLogin.parent_page_url_);
27 gaia.chromeOSLogin.onAttemptedLogin = function(emailFormElement,
28 passwordFormElement,
29 continueUrlElement) {
30 var email = emailFormElement.value;
31 var passwd = passwordFormElement.value;
32 var attemptToken = new Date().getTime();
34 gaia.chromeOSLogin.attemptLogin(email, passwd, attemptToken);
36 if (continueUrlElement) {
37 var prevAttemptIndex = continueUrlElement.value.indexOf('?attemptToken');
38 if (prevAttemptIndex != -1) {
39 continueUrlElement.value =
40 continueUrlElement.value.substr(0, prevAttemptIndex);
42 continueUrlElement.value += '?attemptToken=' + attemptToken;
46 function submitAndGo() {
47 gaia.chromeOSLogin.onAttemptedLogin(document.getElementById("Email"),
48 document.getElementById("Passwd"),
49 document.getElementById("continue"));
50 return true;
53 function onAuthError() {
54 if (window.domAutomationController) {
55 window.domAutomationController.sendWithId(4444, 'loginfail');
59 function onLoad() {
60 gaia.chromeOSLogin.clearOldAttempts();
62 </SCRIPT>
63 </HEAD>
64 <BODY onload='onLoad();'>
65 Local Auth Server:<BR>
66 <FORM action='/ServiceLoginAuth' method=POST onsubmit='submitAndGo()'>
67 <INPUT TYPE=text id="Email" name="Email">
68 <INPUT TYPE=text id="Passwd" name="Passwd">
69 <INPUT TYPE=hidden id="continue" name="continue"
70 value="chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/success.html">
71 <INPUT TYPE=Submit id="signIn">
72 </FORM>
73 </BODY>
74 </HTML>