Skip to content
Browse files

EUCA-4114: trim beginning and trailing white spaces in the login fields

  • Loading branch information...
1 parent f4778ac commit 9eba235a7795564c4de2d9765743a02e83c082a1 @sangmin sangmin committed
Showing with 11 additions and 3 deletions.
  1. +4 −3 console/static/js/login.js
  2. +7 −0 console/static/js/support.js
View
7 console/static/js/login.js
@@ -57,11 +57,12 @@
$('<img>').attr('id','login-spin-wheel').attr('src','images/dots32.gif'));
var param = {
- account:$form.find('input[id=account]').val(),
- username:$form.find('input[id=username]').val(),
- password:$form.find('input[id=password]').val(),
+ account:trim($form.find('input[id=account]').val()),
+ username:trim($form.find('input[id=username]').val()),
+ password:trim($form.find('input[id=password]').val()),
remember:$form.find('input[id=remember]').attr('checked')
};
+
thisObj._trigger('doLogin', evt, { param: param,
onSuccess: function(args){
$login.remove();
View
7 console/static/js/support.js
@@ -575,3 +575,10 @@ function sortArray(array, comperator){
return array;
return mergeSort(array, 0, array.length-1);
}
+
+function trim (str) {
+ if(str)
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
+ else
+ return str;
+}

0 comments on commit 9eba235

Please sign in to comment.
Something went wrong with that request. Please try again.