• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<HTML>
2<HEAD>
3<SCRIPT>
4var gaia = gaia || {};
5gaia.chromeOSLogin = {};
6
7gaia.chromeOSLogin.parent_page_url_ =
8'chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html';
9
10gaia.chromeOSLogin.attemptLogin = function(email, password, attemptToken) {
11  var msg = {
12    'method': 'attemptLogin',
13    'email': email,
14    'password': password,
15    'attemptToken': attemptToken
16  };
17  window.parent.postMessage(msg, gaia.chromeOSLogin.parent_page_url_);
18};
19
20gaia.chromeOSLogin.clearOldAttempts = function() {
21  var msg = {
22    'method': 'clearOldAttempts'
23  };
24  window.parent.postMessage(msg, gaia.chromeOSLogin.parent_page_url_);
25};
26
27gaia.chromeOSLogin.onAttemptedLogin = function(emailFormElement,
28                                               passwordFormElement,
29                                               continueUrlElement) {
30    var email = emailFormElement.value;
31    var passwd = passwordFormElement.value;
32    var attemptToken = new Date().getTime();
33
34    gaia.chromeOSLogin.attemptLogin(email, passwd, attemptToken);
35
36    if (continueUrlElement) {
37      var prevAttemptIndex = continueUrlElement.value.indexOf('?attemptToken');
38      if (prevAttemptIndex != -1) {
39        continueUrlElement.value =
40            continueUrlElement.value.substr(0, prevAttemptIndex);
41      }
42      continueUrlElement.value += '?attemptToken=' + attemptToken;
43    }
44};
45
46function submitAndGo() {
47  gaia.chromeOSLogin.onAttemptedLogin(document.getElementById("Email"),
48                                      document.getElementById("Passwd"),
49                                      document.getElementById("continue"));
50  return true;
51}
52
53function onAuthError() {
54  if (window.domAutomationController) {
55    window.domAutomationController.sendWithId(4444, 'loginfail');
56  }
57}
58
59function onLoad() {
60  gaia.chromeOSLogin.clearOldAttempts();
61}
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>
75