[Kimchi-devel] [PATCH 2/5] Use proper term "user name" instead of "user id"

Aline Manera alinefm at linux.vnet.ibm.com
Fri Apr 11 20:57:58 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

In the Linux environment, a user ID is an integer code which identifies
a user; a user name is the human friendly text identifier of that user.
Kimchi uses both terms interchangeably.

Rename all occurrences of "userid" (and its variants) to "username" (and
its variants) in external UI messages and internal code.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 po/en_US.po                      |   33 +++++++++++++++++++++++++++++++--
 po/kimchi.pot                    |   33 +++++++++++++++++++++++++++++++--
 po/pt_BR.po                      |   38 +++++++++++++++++++++++++++++++++++---
 po/zh_CN.po                      |   36 +++++++++++++++++++++++++++++++++---
 src/kimchi/auth.py               |   38 +++++++++++++++++++-------------------
 src/kimchi/i18n.py               |    2 +-
 src/kimchi/root.py               |    4 ++--
 tests/test_rest.py               |    8 ++++----
 tests/utils.py                   |    2 +-
 ui/js/src/kimchi.login_window.js |   16 ++++++++--------
 ui/js/src/kimchi.user.js         |   14 +++++++-------
 ui/pages/login-window.html.tmpl  |    4 ++--
 12 files changed, 174 insertions(+), 54 deletions(-)

diff --git a/po/en_US.po b/po/en_US.po
index f2abcf0..0b05f1e 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-26 16:19-0300\n"
+"POT-Creation-Date: 2014-04-09 17:11-0300\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -379,6 +379,11 @@ msgid "Create a network"
 msgstr "Create a network"
 
 msgid ""
+"This network is not persistent. Instead of stop, this action will "
+"permanently delete it. Would you like to continue?"
+msgstr ""
+
+msgid ""
 "This will permanently delete the storage pool. Would you like to continue?"
 msgstr ""
 
@@ -662,6 +667,9 @@ msgstr "VLAN ID"
 msgid "No templates found."
 msgstr "No templates found."
 
+msgid "Clone"
+msgstr ""
+
 msgid "Location"
 msgstr "Location"
 
@@ -797,7 +805,11 @@ msgid "Datastore is not initiated in the model object."
 msgstr ""
 
 #, python-format
-msgid "Authentication failed for user '%(userid)s'. [Error code: %(code)s]"
+msgid "Unable to start task due error: %(err)s"
+msgstr ""
+
+#, python-format
+msgid "Authentication failed for user '%(username)s'. [Error code: %(code)s]"
 msgstr ""
 
 msgid "You are not authorized to access Kimchi"
@@ -1038,6 +1050,14 @@ msgid "The volume: %(volume)s in not in storage pool %(pool)s"
 msgstr ""
 
 #, python-format
+msgid "Unable to create template due error: %(err)s"
+msgstr ""
+
+#, python-format
+msgid "Unable to delete template due error: %(err)s"
+msgstr ""
+
+#, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr ""
 
@@ -1179,6 +1199,10 @@ msgid ""
 msgstr ""
 
 #, python-format
+msgid "Unable to update database with deep scan information due error: %(err)s"
+msgstr ""
+
+#, python-format
 msgid "Storage volume %(name)s already exists"
 msgstr ""
 
@@ -1247,6 +1271,11 @@ msgid "Storage volume requires a volume name"
 msgstr ""
 
 #, python-format
+msgid ""
+"Unable to update database with storage volume information due error: %(err)s"
+msgstr ""
+
+#, python-format
 msgid "Interface %(name)s does not exist"
 msgstr ""
 
diff --git a/po/kimchi.pot b/po/kimchi.pot
index 7b33eb3..92d5401 100755
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-26 16:19-0300\n"
+"POT-Creation-Date: 2014-04-09 17:11-0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -373,6 +373,11 @@ msgid "Create a network"
 msgstr ""
 
 msgid ""
+"This network is not persistent. Instead of stop, this action will "
+"permanently delete it. Would you like to continue?"
+msgstr ""
+
+msgid ""
 "This will permanently delete the storage pool. Would you like to continue?"
 msgstr ""
 
@@ -650,6 +655,9 @@ msgstr ""
 msgid "No templates found."
 msgstr ""
 
+msgid "Clone"
+msgstr ""
+
 msgid "Location"
 msgstr ""
 
@@ -785,7 +793,11 @@ msgid "Datastore is not initiated in the model object."
 msgstr ""
 
 #, python-format
-msgid "Authentication failed for user '%(userid)s'. [Error code: %(code)s]"
+msgid "Unable to start task due error: %(err)s"
+msgstr ""
+
+#, python-format
+msgid "Authentication failed for user '%(username)s'. [Error code: %(code)s]"
 msgstr ""
 
 msgid "You are not authorized to access Kimchi"
@@ -1026,6 +1038,14 @@ msgid "The volume: %(volume)s in not in storage pool %(pool)s"
 msgstr ""
 
 #, python-format
+msgid "Unable to create template due error: %(err)s"
+msgstr ""
+
+#, python-format
+msgid "Unable to delete template due error: %(err)s"
+msgstr ""
+
+#, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr ""
 
@@ -1167,6 +1187,10 @@ msgid ""
 msgstr ""
 
 #, python-format
+msgid "Unable to update database with deep scan information due error: %(err)s"
+msgstr ""
+
+#, python-format
 msgid "Storage volume %(name)s already exists"
 msgstr ""
 
@@ -1235,6 +1259,11 @@ msgid "Storage volume requires a volume name"
 msgstr ""
 
 #, python-format
+msgid ""
+"Unable to update database with storage volume information due error: %(err)s"
+msgstr ""
+
+#, python-format
 msgid "Interface %(name)s does not exist"
 msgstr ""
 
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 4967e1d..cbb2b31 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-26 16:19-0300\n"
+"POT-Creation-Date: 2014-04-09 17:11-0300\n"
 "PO-Revision-Date: 2013-06-27 10:48+0000\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: Aline Manera <alinefm at br.ibm.com>\n"
@@ -407,6 +407,14 @@ msgstr ""
 msgid "Create a network"
 msgstr "Criar uma rede"
 
+#, fuzzy
+msgid ""
+"This network is not persistent. Instead of stop, this action will "
+"permanently delete it. Would you like to continue?"
+msgstr ""
+"O storage pool não é persistente. Ao invés de desativar, essa ação vai "
+"removê-lo permanentemente. Deseja continuar?"
+
 msgid ""
 "This will permanently delete the storage pool. Would you like to continue?"
 msgstr "O storage pool vai ser permanentemente removido. Deseja continuar?"
@@ -695,6 +703,9 @@ msgstr "VLAN ID"
 msgid "No templates found."
 msgstr "Nenhum modelo encontrado."
 
+msgid "Clone"
+msgstr ""
+
 msgid "Location"
 msgstr "Localização"
 
@@ -829,8 +840,12 @@ msgstr "Essa API suporta apenas JSON"
 msgid "Datastore is not initiated in the model object."
 msgstr "Datastore não é inicializado no objeto modelo."
 
-#, python-format
-msgid "Authentication failed for user '%(userid)s'. [Error code: %(code)s]"
+#, fuzzy, python-format
+msgid "Unable to start task due error: %(err)s"
+msgstr "Não foi possível iniciar a máquina virtual %(name)s. Detalhes: %(err)s"
+
+#, fuzzy, python-format
+msgid "Authentication failed for user '%(username)s'. [Error code: %(code)s]"
 msgstr "O usuário '%(userid)s' falhou na autenticação. [Error code: %(code)s]"
 
 msgid "You are not authorized to access Kimchi"
@@ -1092,6 +1107,14 @@ msgstr ""
 msgid "The volume: %(volume)s in not in storage pool %(pool)s"
 msgstr "O volume de storage: %(volume)s não existe no storage pool %(pool)s"
 
+#, fuzzy, python-format
+msgid "Unable to create template due error: %(err)s"
+msgstr "Não é possível criar o storage pool %(name)s.Detalhes: %(err)s"
+
+#, fuzzy, python-format
+msgid "Unable to delete template due error: %(err)s"
+msgstr "Incapaz de deletar a rede ativa %(name)s"
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Storage pool %(name)s já existe"
@@ -1254,6 +1277,10 @@ msgstr ""
 "Um grupo de volume chamado '%(name)s' já existe. Por favor, escolher outro "
 "nome para criar o pool lógico."
 
+#, fuzzy, python-format
+msgid "Unable to update database with deep scan information due error: %(err)s"
+msgstr "Incapaz de carregar as informações do repositório. Detalhes: %(err)s"
+
 #, python-format
 msgid "Storage volume %(name)s already exists"
 msgstr "Volume de storage %(name)s já existe"
@@ -1329,6 +1356,11 @@ msgstr "Formato do volume não suportado"
 msgid "Storage volume requires a volume name"
 msgstr "Volume requer um nome"
 
+#, fuzzy, python-format
+msgid ""
+"Unable to update database with storage volume information due error: %(err)s"
+msgstr "Incapaz de deletar o volume %(name)s. Detalhes: %(err)s"
+
 #, python-format
 msgid "Interface %(name)s does not exist"
 msgstr "Interface %(name)s não existe"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 6393b83..3b3754c 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-28 15:35+0800\n"
+"POT-Creation-Date: 2014-04-09 17:11-0300\n"
 "PO-Revision-Date: 2013-06-27 10:48+0000\n"
 "Last-Translator: ShaoHe Feng <shaohef at linux.vnet.ibm.com>\n"
 "Language-Team: ShaoHe Feng <shaohef at linux.vnet.ibm.com>\n"
@@ -389,6 +389,12 @@ msgstr "此操作将中断依赖此网络的虚拟机的网络连接。"
 msgid "Create a network"
 msgstr "创建一个网络"
 
+#, fuzzy
+msgid ""
+"This network is not persistent. Instead of stop, this action will "
+"permanently delete it. Would you like to continue?"
+msgstr "对于非持久存储池,这个操作将会永久删除存储池而不是停用。是否继续?"
+
 msgid ""
 "This will permanently delete the storage pool. Would you like to continue?"
 msgstr "这将永久删除存储池。是否继续?"
@@ -669,6 +675,9 @@ msgstr "VLAN号"
 msgid "No templates found."
 msgstr "没有发现模板"
 
+msgid "Clone"
+msgstr ""
+
 msgid "Location"
 msgstr "路径"
 
@@ -803,8 +812,12 @@ msgstr "这个API仅支持JSON"
 msgid "Datastore is not initiated in the model object."
 msgstr "尚未为model对象初始化数据存储。"
 
-#, python-format
-msgid "Authentication failed for user '%(userid)s'. [Error code: %(code)s]"
+#, fuzzy, python-format
+msgid "Unable to start task due error: %(err)s"
+msgstr "不能启动虚拟机 %(name)s. 详情:%(err)s"
+
+#, fuzzy, python-format
+msgid "Authentication failed for user '%(username)s'. [Error code: %(code)s]"
 msgstr "用户 '%(userid)s' 验证失败。[错误代码: %(code)s]"
 
 msgid "You are not authorized to access Kimchi"
@@ -1048,6 +1061,14 @@ msgstr "当模板的存储池是iscsi或scsi时,必须为模板指定一个卷
 msgid "The volume: %(volume)s in not in storage pool %(pool)s"
 msgstr "存储池%(pool)s中没有存储卷%(volume)s"
 
+#, fuzzy, python-format
+msgid "Unable to create template due error: %(err)s"
+msgstr "不能创建存储池 %(name)s。详情: %(err)s"
+
+#, fuzzy, python-format
+msgid "Unable to delete template due error: %(err)s"
+msgstr "不能删除激活的网络%(name)s"
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "存储池%(name)s已经存在"
@@ -1189,6 +1210,10 @@ msgid ""
 "to create the logical pool."
 msgstr "卷组'%(name)s'已经存在,请选择其它的名字来创建逻辑存储池。"
 
+#, fuzzy, python-format
+msgid "Unable to update database with deep scan information due error: %(err)s"
+msgstr "不能获取软件仓库的信息。详情:'%(err)s'"
+
 #, python-format
 msgid "Storage volume %(name)s already exists"
 msgstr "存储卷%(name)s已经存在"
@@ -1257,6 +1282,11 @@ msgstr "存储卷格式不支持"
 msgid "Storage volume requires a volume name"
 msgstr "存储卷需要名字"
 
+#, fuzzy, python-format
+msgid ""
+"Unable to update database with storage volume information due error: %(err)s"
+msgstr "不能删除存储卷%(name)s。详情:%(err)s"
+
 #, python-format
 msgid "Interface %(name)s does not exist"
 msgstr "接口%(name)s不存在"
diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
index 63e11c4..dc78ded 100644
--- a/src/kimchi/auth.py
+++ b/src/kimchi/auth.py
@@ -35,7 +35,7 @@ from kimchi.exception import InvalidOperation, OperationFailed
 from kimchi.utils import run_command
 
 
-USER_ID = 'userid'
+USER_NAME = 'username'
 USER_GROUPS = 'groups'
 USER_SUDO = 'sudo'
 REFRESH = 'robot-refresh'
@@ -48,15 +48,15 @@ def debug(msg):
 
 class User(object):
 
-    def __init__(self, userid):
+    def __init__(self, username):
         self.user = {}
-        self.user[USER_ID] = userid
+        self.user[USER_NAME] = username
         self.user[USER_GROUPS] = None
         self.user[USER_SUDO] = False
 
     def get_groups(self):
         self.user[USER_GROUPS] = [g.gr_name for g in grp.getgrall()
-                                  if self.user[USER_ID] in g.gr_mem]
+                                  if self.user[USER_NAME] in g.gr_mem]
         return self.user[USER_GROUPS]
 
     def has_sudo(self):
@@ -72,16 +72,16 @@ class User(object):
         os.setsid()
         fcntl.ioctl(slave, termios.TIOCSCTTY, 0)
 
-        out, err, exit = run_command(['sudo', '-l', '-U', self.user[USER_ID],
+        out, err, exit = run_command(['sudo', '-l', '-U', self.user[USER_NAME],
                                       'sudo'])
         if exit == 0:
-            debug("User %s is allowed to run sudo" % self.user[USER_ID])
+            debug("User %s is allowed to run sudo" % self.user[USER_NAME])
             # sudo allows a wide range of configurations, such as controlling
             # which binaries the user can execute with sudo.
             # For now, we will just check whether the user is allowed to run
             # any command with sudo.
             out, err, exit = run_command(['sudo', '-l', '-U',
-                                          self.user[USER_ID]])
+                                          self.user[USER_NAME]])
             for line in out.split('\n'):
                 if line and re.search("(ALL)", line):
                     result.value = 1
@@ -89,9 +89,9 @@ class User(object):
                           result.value)
                     return
             debug("User %s can only run some commands with sudo" %
-                  self.user[USER_ID])
+                  self.user[USER_NAME])
         else:
-            debug("User %s is not allowed to run sudo" % self.user[USER_ID])
+            debug("User %s is not allowed to run sudo" % self.user[USER_NAME])
 
     def get_user(self):
         return self.user
@@ -125,7 +125,7 @@ def authenticate(username, password, service="passwd"):
     try:
         auth.authenticate()
     except PAM.error, (resp, code):
-        msg_args = {'userid': username, 'code': code}
+        msg_args = {'username': username, 'code': code}
         raise OperationFailed("KCHAUTH0001E", msg_args)
 
     return True
@@ -145,7 +145,7 @@ def check_auth_session():
     for the user.
     """
     cherrypy.session.acquire_lock()
-    session = cherrypy.session.get(USER_ID, None)
+    session = cherrypy.session.get(USER_NAME, None)
     cherrypy.session.release_lock()
     if session is not None:
         debug("Session authenticated for user %s" % session)
@@ -153,7 +153,7 @@ def check_auth_session():
         if kimchiRobot == "kimchi-robot":
             if (time.time() - cherrypy.session[REFRESH] >
                     cherrypy.session.timeout * 60):
-                cherrypy.session[USER_ID] = None
+                cherrypy.session[USER_NAME] = None
                 cherrypy.lib.sessions.expire()
                 raise cherrypy.HTTPError(401)
         else:
@@ -183,20 +183,20 @@ def check_auth_httpba():
     b64data = re.sub("Basic ", "", authheader)
     decodeddata = base64.b64decode(b64data.encode("ASCII"))
     # TODO: test how this handles ':' characters in username/passphrase.
-    userid, password = decodeddata.decode().split(":", 1)
+    username, password = decodeddata.decode().split(":", 1)
 
-    return login(userid, password)
+    return login(username, password)
 
 
-def login(userid, password):
-    if not authenticate(userid, password):
+def login(username, password):
+    if not authenticate(username, password):
         debug("User cannot be verified with the supplied password")
         return None
-    user = User(userid)
+    user = User(username)
     debug("User verified, establishing session")
     cherrypy.session.acquire_lock()
     cherrypy.session.regenerate()
-    cherrypy.session[USER_ID] = userid
+    cherrypy.session[USER_NAME] = username
     cherrypy.session[USER_GROUPS] = user.get_groups()
     cherrypy.session[USER_SUDO] = user.has_sudo()
     cherrypy.session[REFRESH] = time.time()
@@ -206,7 +206,7 @@ def login(userid, password):
 
 def logout():
     cherrypy.session.acquire_lock()
-    cherrypy.session[USER_ID] = None
+    cherrypy.session[USER_NAME] = None
     cherrypy.session[REFRESH] = 0
     cherrypy.session.release_lock()
     cherrypy.lib.sessions.expire()
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index ae8d24e..0bde5b9 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -34,7 +34,7 @@ messages = {
     "KCHASYNC0001E": _("Datastore is not initiated in the model object."),
     "KCHASYNC0002E": _("Unable to start task due error: %(err)s"),
 
-    "KCHAUTH0001E": _("Authentication failed for user '%(userid)s'. [Error code: %(code)s]"),
+    "KCHAUTH0001E": _("Authentication failed for user '%(username)s'. [Error code: %(code)s]"),
     "KCHAUTH0002E": _("You are not authorized to access Kimchi"),
     "KCHAUTH0003E": _("Specify %(item)s to login into Kimchi"),
     "KCHAUTH0004E": _("This operation is not allowed as you have restricted access to Kimchi."),
diff --git a/src/kimchi/root.py b/src/kimchi/root.py
index 9bae34a..514d75d 100644
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@ -102,14 +102,14 @@ class KimchiRoot(Root):
     def login(self, *args):
         params = parse_request()
         try:
-            userid = params['userid']
+            username = params['username']
             password = params['password']
         except KeyError, item:
             e = MissingParameter('KCHAUTH0003E', {'item': str(item)})
             raise cherrypy.HTTPError(400, e.message)
 
         try:
-            user_info = auth.login(userid, password)
+            user_info = auth.login(username, password)
         except OperationFailed:
             raise cherrypy.HTTPError(401)
 
diff --git a/tests/test_rest.py b/tests/test_rest.py
index cd40d55..6bce606 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -106,7 +106,7 @@ class RestTests(unittest.TestCase):
         # HTTP:401.  Since HTTP Simple Auth is not allowed for text/html, we
         # need to use the login API and establish a session.
         user, pw = fake_user.items()[0]
-        req = json.dumps({'userid': user, 'password': pw})
+        req = json.dumps({'username': user, 'password': pw})
         resp = self.request('/login', req, 'POST')
         self.assertEquals(200, resp.status)
         cookie = resp.getheader('set-cookie')
@@ -1367,7 +1367,7 @@ class RestTests(unittest.TestCase):
             self.assertEquals(200, resp.status)
 
         user, pw = fake_user.items()[0]
-        req = json.dumps({'userid': user, 'password': pw})
+        req = json.dumps({'username': user, 'password': pw})
         resp = self.request('/login', req, 'POST', hdrs)
         self.assertEquals(200, resp.status)
 
@@ -1388,7 +1388,7 @@ class RestTests(unittest.TestCase):
 
         # Test REST API
         hdrs = {'AUTHORIZATION': ''}
-        req = json.dumps({'userid': 'nouser', 'password': 'badpass'})
+        req = json.dumps({'username': 'nouser', 'password': 'badpass'})
         resp = self.request('/login', req, 'POST', hdrs)
         self.assertEquals(401, resp.status)
 
@@ -1413,7 +1413,7 @@ class RestTests(unittest.TestCase):
 
         # Execute a login call
         user, pw = fake_user.items()[0]
-        req = json.dumps({'userid': user, 'password': pw})
+        req = json.dumps({'username': user, 'password': pw})
         resp = self.request('/login', req, 'POST', hdrs)
         self.assertEquals(200, resp.status)
         cookie = resp.getheader('set-cookie')
diff --git a/tests/utils.py b/tests/utils.py
index b373f34..fe03a1a 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -160,7 +160,7 @@ def patch_auth(sudo=True):
         try:
             return fake_user[username] == password
         except KeyError, e:
-            raise OperationFailed("KCHAUTH0001E", {'userid': 'username',
+            raise OperationFailed("KCHAUTH0001E", {'username': 'username',
                                                    'code': e.message})
 
     import kimchi.auth
diff --git a/ui/js/src/kimchi.login_window.js b/ui/js/src/kimchi.login_window.js
index f18981e..44e5617 100644
--- a/ui/js/src/kimchi.login_window.js
+++ b/ui/js/src/kimchi.login_window.js
@@ -56,10 +56,10 @@ kimchi.login_main = function() {
             return;
         }
 
-        var userName = kimchi.user.getUserID();
-        userName && $('#user-id').val(userName);
+        var userName = kimchi.user.getUserName();
+        userName && $('#username').val(userName);
 
-        var nodeToFocus = ! $('#user-id').val() ? $('#user-id') :
+        var nodeToFocus = ! $('#username').val() ? $('#username') :
             (! $('#password').val() ? $('#password') : $('#btn-login'));
 
         $(nodeToFocus).focus();
@@ -67,16 +67,16 @@ kimchi.login_main = function() {
 
     var login = function(event) {
 
-        if (!validateNonEmpty(['user-id', 'password'])) {
+        if (!validateNonEmpty(['username', 'password'])) {
             return false;
         }
 
         $('#btn-login').text(i18n['KCHAUTH6002M']).prop('disabled', true);
 
-        var userID = $('#user-id').val();
-        userID && kimchi.user.setUserID(userID);
+        var userName = $('#username').val();
+        userName && kimchi.user.setUserName(userName);
         var settings = {
-            userid: userID,
+            username: userName,
             password: $("#password").val()
         };
 
@@ -96,7 +96,7 @@ kimchi.login_main = function() {
         }, function() {
             kimchi.message.error.code('KCHAUTH6001E');
             $('#btn-login').prop('disabled', false).text(i18n['KCHAUTH6001M']);
-            placeCursor('user-id');
+            placeCursor('username');
         });
 
         return false;
diff --git a/ui/js/src/kimchi.user.js b/ui/js/src/kimchi.user.js
index bd7d20b..9134849 100644
--- a/ui/js/src/kimchi.user.js
+++ b/ui/js/src/kimchi.user.js
@@ -16,17 +16,17 @@
  * limitations under the License.
  */
 kimchi.user = (function() {
-    var getUserID = function() {
-        return kimchi.cookie.get('userid');
+    var getUserName = function() {
+        return kimchi.cookie.get('username');
     };
 
-    var setUserID = function(userID) {
-        kimchi.cookie.set('userid', userID, 365);
+    var setUserName = function(userName) {
+        kimchi.cookie.set('username', userName, 365);
     };
 
     var showUser = function(toShow) {
         if (toShow) {
-            var userName = getUserID();
+            var userName = getUserName();
             userName && $('#user-name').text(userName);
             $('#user').removeClass('not-logged-in');
             return;
@@ -36,8 +36,8 @@ kimchi.user = (function() {
     };
 
     return {
-        getUserID: getUserID,
-        setUserID: setUserID,
+        getUserName: getUserName,
+        setUserName: setUserName,
         showUser: showUser
     };
 })();
diff --git a/ui/pages/login-window.html.tmpl b/ui/pages/login-window.html.tmpl
index b7850e5..3e451c4 100644
--- a/ui/pages/login-window.html.tmpl
+++ b/ui/pages/login-window.html.tmpl
@@ -34,8 +34,8 @@
   <div class="content login-panel">
     <form id="form-login" action="/login" method="POST">
       <div class="row">
-        <input type="text" id="user-id" name="userid" required="required" placeholder="$_("User Name")" />
-        <div id="user-id-msg" class="msg-required"></div>
+        <input type="text" id="username" name="username" required="required" placeholder="$_("User Name")" />
+        <div id="username-msg" class="msg-required"></div>
       </div>
       <div class="row">
         <input type="password" id="password" name="password" required="required" placeholder="$_("Password")" />
-- 
1.7.10.4




More information about the Kimchi-devel mailing list