From cc456f20b5f5d34b9e00f153293b51f4ec6710e5 Mon Sep 17 00:00:00 2001 From: Vlad Ya Date: Wed, 4 Nov 2015 13:09:29 -0500 Subject: [PATCH] Proper fix for the prefix corruption (for user names with non-alphanumeric characters) and keep the prevention of addition of ftp user names with non-alphanumeric characters as it was intended initially --- web/js/pages/add.web.js | 4 ++-- web/js/pages/edit.web.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/js/pages/add.web.js b/web/js/pages/add.web.js index 2762ba14..7a01f746 100644 --- a/web/js/pages/add.web.js +++ b/web/js/pages/add.web.js @@ -3,11 +3,11 @@ App.Actions.WEB.update_ftp_username_hint = function(elm, hint) { $(elm).parent().find('.hint').html(''); } - //hint = hint.replace(/[^\w\d]/gi, ''); - if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) { hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length); } + hint = hint.replace(/[^\w\d]/gi, ''); + $(elm).parent().find('.v-ftp-user').val(hint); $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint); } diff --git a/web/js/pages/edit.web.js b/web/js/pages/edit.web.js index ef20c831..1406d9d0 100644 --- a/web/js/pages/edit.web.js +++ b/web/js/pages/edit.web.js @@ -3,11 +3,11 @@ App.Actions.WEB.update_ftp_username_hint = function(elm, hint) { $(elm).parent().find('.hint').html(''); } - //hint = hint.replace(/[^\w\d]/gi, ''); - if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) { hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length); } + hint = hint.replace(/[^\w\d]/gi, ''); + $(elm).parent().find('.v-ftp-user').val(hint); $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint); }