OLD | NEW |
(Empty) | |
| 1 <HTML> |
| 2 <HEAD> |
| 3 <SCRIPT> |
| 4 var gaia = gaia || {}; |
| 5 gaia.chromeOSLogin = {}; |
| 6 |
| 7 gaia.chromeOSLogin.parent_page_url_ = |
| 8 'chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html'; |
| 9 |
| 10 gaia.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 |
| 20 gaia.chromeOSLogin.clearOldAttempts = function() { |
| 21 var msg = { |
| 22 'method': 'clearOldAttempts' |
| 23 }; |
| 24 window.parent.postMessage(msg, gaia.chromeOSLogin.parent_page_url_); |
| 25 }; |
| 26 |
| 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(); |
| 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 |
| 46 function submitAndGo() { |
| 47 gaia.chromeOSLogin.onAttemptedLogin(document.getElementById("Email"), |
| 48 document.getElementById("Passwd"), |
| 49 document.getElementById("continue")); |
| 50 return true; |
| 51 } |
| 52 |
| 53 function onAuthError() { |
| 54 if (window.domAutomationController) { |
| 55 window.domAutomationController.sendWithId(4444, 'loginfail'); |
| 56 } |
| 57 } |
| 58 |
| 59 function 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 <INPUT TYPE=Submit id="signIn"> |
| 71 </FORM> |
| 72 </BODY> |
| 73 </HTML> |
OLD | NEW |