Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: remoting/webapp/me2mom/remoting.js

Issue 7048020: Don't use letters in me2mom access code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/me2mom/remoting.js
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 656aa15ad8e3d1a75a7399a42c3ca08f5129654a..7fb163926d947f588115c62da51e1ae5dc3f119b 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -263,6 +263,12 @@ function parseServerResponse_(xhr) {
showConnectError_(xhr.status, xhr.responseText);
}
+function normalizeAccessToken(accessCode) {
+ // Trim whitespace from beginning and the end.
+ // TODO(sergeyu): Do we need to do any other normalization here?
+ return accessCode.replace(/^\s+|\s+$/, '');
+}
+
function resolveSupportId(support_id) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
@@ -282,7 +288,7 @@ function resolveSupportId(support_id) {
}
function tryConnect(form) {
- remoting.accessCode = form['access_code_entry'].value;
+ remoting.accessCode = normalizeAccessToken(form['access_code_entry'].value);
// TODO(jamiewalch): Since the mapping from (SupportId, HostSecret) to
// AccessCode is not yet defined, assume it's hyphen-separated for now.
var parts = remoting.accessCode.split('-');
« remoting/host/support_access_verifier.cc ('K') | « remoting/protocol/auth_token_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698