[Kimchi-devel] [PATCH 1/3] Remove former login design files

alinefm at linux.vnet.ibm.com alinefm at linux.vnet.ibm.com
Sun Jul 13 22:16:39 UTC 2014


From: Aline Manera <alinefm at linux.vnet.ibm.com>

ui/js/src/kimchi.login_window.js and ui/pages/login-window.html.tmpl are
not being used anymore since Kimchi switched to the traditional login
flow. So remove them.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.login_window.js | 128 ---------------------------------------
 ui/pages/login-window.html.tmpl  |  53 ----------------
 2 files changed, 181 deletions(-)
 delete mode 100644 ui/js/src/kimchi.login_window.js
 delete mode 100644 ui/pages/login-window.html.tmpl

diff --git a/ui/js/src/kimchi.login_window.js b/ui/js/src/kimchi.login_window.js
deleted file mode 100644
index c562159..0000000
--- a/ui/js/src/kimchi.login_window.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-kimchi.login_main = function() {
-
-    var selectedLanguage = kimchi.lang.get();
-    var languages = kimchi.lang.all();
-    for(var k in languages) {
-        var opt = $([
-            '<option value="',
-            k,
-            '">',
-            languages[k],
-            '</option>'
-        ].join('')).appendTo($('#language'));
-        $(opt).prop('selected', selectedLanguage === k);
-    }
-
-    $('#language').on('change', function() {
-        kimchi.topic('languageChanged').publish($(this).val());
-    });
-
-    var validateNonEmpty = function(idsArray) {
-        for(var i = 0; i < idsArray.length; i++) {
-            var id = idsArray[i];
-            if (!$('#' + id).val()) {
-                $('#' + id + '-msg').text(i18n['KCHAUTH6002E']);
-                placeCursor(id);
-                return false;
-            }
-            else {
-                $('#' + id + '-msg').empty();
-            }
-        }
-
-        return true;
-    };
-
-    var userNameBox = $('#username');
-    var passwordBox = $('#password');
-    var loginButton = $('#btn-login');
-    var placeCursor = function(id) {
-        if (id && $('#' + id).size() > 0) {
-            $('#' + id).focus();
-            return;
-        }
-
-        var userName = kimchi.user.getUserName();
-        userName && !userNameBox.val() && userNameBox.val(userName);
-        var password = passwordBox.val();
-
-        var nodeToFocus = !userName ? userNameBox : !password ? passwordBox : loginButton;
-
-        $(nodeToFocus).focus();
-    };
-
-    var login = function(event) {
-
-        if (!validateNonEmpty(['username', 'password'])) {
-            return false;
-        }
-
-        loginButton.text(i18n['KCHAUTH6002M']).prop('disabled', true);
-
-        var userName = userNameBox.val();
-        userName && kimchi.user.setUserName(userName);
-        var settings = {
-            username: userName,
-            password: passwordBox.val()
-        };
-
-        kimchi.login(settings, function() {
-            var pAjax = kimchi.previousAjax;
-            var consoleURL = kimchi.cookie.get("console_uri");
-            if (consoleURL) {
-                var path = /.*\/(.*?)\?.*/g.exec(consoleURL)[1];
-                var query = consoleURL.substr(consoleURL.indexOf("?") + 1);
-
-                var proxy_port = /.*port=(.*?)(&|$)/g.exec(consoleURL)[1];
-                var http_port = /.*kimchi=(.*?)(&|$)/g.exec(consoleURL);
-                var kimchi_port = http_port ? http_port[1] : location.port;
-
-                url = location.protocol + "//" + location.hostname;
-                url += ":" + proxy_port + "/console.html?url=" + path;
-                url += "&" + query;
-                url += "&kimchi=" + kimchi_port;
-
-                kimchi.cookie.remove("console_uri");
-                window.location.replace(url)
-            }
-            else if (pAjax && true === pAjax['resend']) {
-                pAjax['error'] = pAjax['originalError'];
-                $.ajax(pAjax);
-                kimchi.previousAjax = null;
-            }
-            else if(pAjax) {
-                window.location.reload();
-            }
-
-            kimchi.user.showUser(true);
-            kimchi.window.close();
-        }, function() {
-            kimchi.message.error.code('KCHAUTH6001E');
-            $('#btn-login').prop('disabled', false).text(i18n['KCHAUTH6001M']);
-            placeCursor('username');
-        });
-
-        return false;
-    };
-
-    $('#form-login').on('submit', login);
-
-    setTimeout(placeCursor, 0);
-};
diff --git a/ui/pages/login-window.html.tmpl b/ui/pages/login-window.html.tmpl
deleted file mode 100644
index 3e451c4..0000000
--- a/ui/pages/login-window.html.tmpl
+++ /dev/null
@@ -1,53 +0,0 @@
-#*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *#
-#unicode UTF-8
-#import gettext
-#from kimchi.cachebust import href
-#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang)
-#silent _ = t.gettext
-#silent _t = t.gettext
-<div id="login-window" class="window">
-  <header>
-    <div class="logo"></div>
-    <span class="title">$_("Log In")</span>
-    <form id="form-language" class="language" action="" method="GET">
-      <div id="lang-selection-wrapper">
-        <select id="language" class="i18n-selector"></select>
-      </div>
-    </form>
-  </header>
-  <div class="content login-panel">
-    <form id="form-login" action="/login" method="POST">
-      <div class="row">
-        <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")" />
-        <div id="password-msg" class="msg-required"></div>
-      </div>
-      <div class="row">
-        <button id="btn-login" class="btn-normal">$_("Log in")</button>
-      </div>
-    </form>
-  </div>
-</div>
-
-<script type="text/javascript">
-  kimchi.login_main();
-</script>
-- 
1.9.3




More information about the Kimchi-devel mailing list