<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 06/03/2014 04:15 PM, Yu Xin Huo
      wrote:<br>
    </div>
    <blockquote cite="mid:538D840C.8000505@linux.vnet.ibm.com"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 6/3/2014 11:30 AM, Yu Xin Huo
        wrote:<br>
      </div>
      <blockquote cite="mid:538D416B.4040505@linux.vnet.ibm.com"
        type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        <div class="moz-cite-prefix">tested, see issues below:<br>
          <br>
          1. I always see the kimchi UI tabs before login page, as it is
          server side re-direct, why kimchi tabs appear?<br>
          <br>
          2. when username or password is wrong, it is directed to an
          error page with content below, it should be back to login page
          with an error message.&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
          <div class="error-msg error-icon">
            <div class=" error-text">
              <h4><i>ERROR CODE</i></h4>
              <i> </i></div>
            <i> </i>
            <div class="error-text"> <i><span>500 Internal Server Error</span></i>
            </div>
            <i> </i>
            <div class="error-text">
              <h4><i>REASON</i></h4>
            </div>
            <i> </i>
            <div class="error-text"> <i><span>The server encountered an
                  unexpected condition which prevented it from
                  fulfilling the request.</span></i> </div>
            <i> </i>
            <div class="error-text">
              <h4><i>STACK</i></h4>
            </div>
            <i> </i>
            <div class="error-text"><i> </i>
              <pre><i>Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.6/site-packages/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/root/kimchi-repo/test/kimchi/src/kimchi/root.py", line 129, in login
    auth.login(username, password)
  File "/root/kimchi-repo/test/kimchi/src/kimchi/auth.py", line 198, in login
    if not authenticate(username, password):
  File "/root/kimchi-repo/test/kimchi/src/kimchi/auth.py", line 135, in authenticate
    raise OperationFailed("KCHAUTH0001E", msg_args)
OperationFailed: KCHAUTH0001E: Authentication failed for user 'root'. [Error code: 7]</i></pre>
            </div>
          </div>
        </div>
      </blockquote>
      <i>3. there need to be message about "login fail" and "session
        timeout", need backend API available on html page to get the
        message.</i><br>
    </blockquote>
    seems it is&nbsp; hard to distinguish&nbsp; <i>session timeout </i><i>from
      longout.<br>
    </i>
    <blockquote cite="mid:538D840C.8000505@linux.vnet.ibm.com"
      type="cite">
      <blockquote cite="mid:538D416B.4040505@linux.vnet.ibm.com"
        type="cite">
        <div class="moz-cite-prefix">
          <div class="error-msg error-icon">
            <div class="error-text">
              <pre>
&nbsp;
</pre>
            </div>
          </div>
          <br>
          On 5/31/2014 1:16 AM, <a moz-do-not-send="true"
            class="moz-txt-link-abbreviated"
            href="mailto:shaohef@linux.vnet.ibm.com">shaohef@linux.vnet.ibm.com</a>
          wrote:<br>
        </div>
        <blockquote
          cite="mid:1401470190-7371-1-git-send-email-shaohef@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">From: ShaoHe Feng <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>

this page is used for the session timeout or first login.

Signed-off-by: ShaoHe Feng <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
Signed-off-by: Yu Xin Huo <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:huoyuxin@linux.vnet.ibm.com">&lt;huoyuxin@linux.vnet.ibm.com&gt;</a>
---
 ui/images/progressing.gif | Bin 0 -&gt; 1152 bytes
 ui/pages/login.html.tmpl  | 247 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 247 insertions(+)
 create mode 100644 ui/images/progressing.gif
 create mode 100644 ui/pages/login.html.tmpl

diff --git a/ui/images/progressing.gif b/ui/images/progressing.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6552d41d9d4c874091bb51931c6adf64a95e8bd0
GIT binary patch
literal 1152
zcmZ?wbhEHb6k!ly*v!E2|NsBHckiA#b7s?~O&amp;uK_IXO9@p`oUxrgCy}4A_9;e{Mh5
zkYH!W09PYD17=2`8pWS1oFWVy3_2k7AY&amp;O=+5}E^`WY^hIhD@I;2`qkhUamCHs#2?
zD{Sl5ddqAu;o;E8n07H&amp;VTOd$9w+z3Od8dz)1OOlg@hfQ?6P6gg)Nhut~h8s_iHy|
zTx?f&lt;DfNuF4qs+in1T70o7P)P87f1&lt;g5(0~t-`bz%`;&lt;c7;R*Hby&amp;0+Cd*D$nyx)7
zxH&gt;hoEs9-2GEYbl&lt;TO?^r*$AZO&amp;~F#&lt;dR{_!xK!0-EtLPZ*p|yWoF`%&gt;SmZA?aQ&lt;9
zUT3kA$h=8X2{%vLaEeZ2FfFvxHCy+@)2xTXXx&amp;nW19L8~I4mhFCLSR*N5YUN_g8RC
zxvG$d3rC2Yoni&gt;Hr8Z+mk+UtMt&amp;Fyriq3S|nYyz*lh|s_)v7fmBnyPWjzbSOeSwpn
ztM^*GK3gr@WX{W=;H4@s$Eix`o#&amp;Z+UC|vq;?Mm$*qz&gt;q{MpOLKD$V&gt;lW^GM@gRp&lt;
zTfqAxmTMW#NQtz1Ow(GUENaLTnG@~OSSl%)a-~@^*=_L^Wu6LazRZG$dI^iu%U-z%
zg&lt;00g*_8=1ySk){v9Pk(*~&lt;9qvQD2qQDdsojG1{NY_a__TQemj7eK-u-Fqm&gt;f&gt;utm
zWMS=L&amp;jJU059@Suul#8&lt;RCK0juuU^pO9X~|9`=wYHdzoCYCehQmh?GGSt;IO&amp;EY61
z^|cU^WKC}pQa3GC)^bS)J5HFrADAqr$@=Tg_KIeUMR6Q@nr+9QW_y9zNsLj!T)@YO
zmFW&gt;EN`0IXPrZ&gt;S5M3ptD%hrTMQhc8T&gt;+_g4tF#}E)IMpc&lt;k8J3C&gt;bEce!tTI4V-^
zEEL|{;B8wW%&lt;SUK!k*&gt;CY&amp;#hksVX{CWv466RGb|aXRcN%49rjY*aHrnWY;d4a(eT&lt;
sn9_&lt;U58lHODbH9KGQC;#6@s@G?AG7t-SQycLr1Fr#FC=U9tH+$0KoWQ9smFU

literal 0
HcmV?d00001

diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
new file mode 100644
index 0000000..e7afbb3
--- /dev/null
+++ b/ui/pages/login.html.tmpl
@@ -0,0 +1,247 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014
+ *
+ * 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
+ *
+ *     <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
+ *
+ * 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
+#from kimchi.config import get_version
+&lt;!DOCTYPE html&gt;
+&lt;html lang="$lang.lang[0]"&gt;
+&lt;head&gt;
+&lt;meta charset="UTF-8"&gt;
+&lt;title&gt;Kimchi&lt;/title&gt;
+&lt;meta http-equiv="X-UA-Compatible" content="IE=edge"/&gt;
+&lt;meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /&gt;
+
+&lt;style type="text/css"&gt;
+.login {
+    font-family: Arial;
+    margin: 0px;
+}
+
+.login input.invalid-field {
+    border-color: #C85305 !important;
+}
+
+.login .header {
+    background: none repeat scroll 0 0 #353D40;
+    border-bottom: 3px solid #008ABF;
+    border-top: 0 none;
+    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
+    height: 50px;
+    color: #F8F8F8;
+    font-size: 13px;
+    font-weight: 700;
+    font-family: Helvetica;
+    overflow: hidden;
+}
+
+.login .header .lang {
+    float: right;
+    margin-right: 20px;
+    margin-top: 14px;
+}
+
+.login .header .lang select {
+    vertical-align: middle;
+}
+
+.login .content-pane {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: 200px;
+    width: 260px;
+}
+
+.login .content-pane .trademark {
+    margin-bottom: 30px;
+}
+
+.login .content-pane .trademark .logo {
+    background: url("../images/logo.ico") no-repeat scroll center center transparent;
+    display: inline-block;
+    height: 25px;
+    width: 25px;
+    margin-left: -4px;
+    margin-right: 5px;
+    vertical-align: middle;
+}
+
+.login .content-pane .trademark .name {
+    vertical-align: middle;
+    padding-top: 2px;
+    font-weight: bold;
+    font-size: 18px;
+}
+
+.login .content-pane .trademark .version {
+    vertical-align: middle;
+    padding-top: 6px;
+    font-size: 13px;
+    padding-left: 6px;
+}
+
+.login .content-pane .message-area .item {
+    font-size: 12px;
+    margin-bottom: 30px;
+    margin-top: 30px;
+    height: 20px;
+}
+
+.login .content-pane .message-area .text {
+    color: #C85305;
+}
+
+.login .progress-indicator .progress-icon {
+    margin-right: 3px;
+    vertical-align: middle;
+    width: 15px;
+    height: 15px;
+}
+
+.login .progress-indicator .progress-text {
+    vertical-align: middle;
+    padding-top: 2px;
+}
+
+.login .content-pane .hint {
+    margin-bottom: 10px;
+    font-size: 14px;
+}
+
+.login .content-pane .field-area {
+    overflow: hidden;
+}
+
+.login .content-pane .field-area .text-field {
+    width: 240px;
+    padding: 5px 7px;
+    margin-bottom: 5px;
+    border: 1px solid #BABABA;
+    border-radius: 1px;
+}
+
+.login .button {
+    margin-top: 20px;
+    background: -moz-linear-gradient(center top , #1783BF 0%, #0C4C88 100%) repeat scroll 0 0 transparent;
+    border-color: #666666 #666666 #555555;
+    border-image: none;
+    border-radius: 5px 5px 5px 5px;
+    border-style: solid;
+    border-width: 1px;
+    color: #DDDDDD;
+    cursor: pointer;
+    font-weight: bolder;
+    padding: 5px 10px;
+    float: right;
+}
+&lt;/style&gt;
+
+&lt;script&gt;
+
+function validateForm() {
+    var user = document.forms["login"]["username"];
+    var pass = document.forms["login"]["password"];
+    var validateField = function(field){
+        field.className = "text-field";
+        var isValid = field.value &amp;&amp; field.value.trim()!="" ? true : false;
+        if(!isValid) field.className += " invalid-field";
+        return isValid;
+    };
+    var isValid = validateField(user);
+    isValid = validateField(pass) &amp;&amp; isValid;
+    if(isValid)
+        document.getElementById("messWait").style.display = "";
+    return isValid;
+}
+
+function getCookie(cname) {
+    var name = cname + "=";
+    var ca = document.cookie.split(';');
+    for(var i=0; i&lt;ca.length; i++) {
+        var c = ca[i].trim();
+        if (c.indexOf(name)==0) return c.substring(name.length,c.length);
+    }
+    return null;
+}
+
+function setCookie(cname,cvalue,exdays) {
+    var d = new Date();
+    d.setTime(d.getTime()+(exdays*24*60*60*1000));
+    var expires = "expires="+d.toGMTString();
+    document.cookie = cname + "=" + cvalue + "; " + expires;
+}
+
+function init() {
+    var defaultLang = 'en_US';
+    var clientLang = document.getElementById('userLang').value;
+    var persistLang = getCookie('kimchiLang');
+    document.getElementById("userLang").value = persistLang || clientLang || defaultLang;
+/*
+    var url = window.location.href;
+    if(url.indexOf("wrongUserPass")!=-1)
+        document.getElementById("messUserPass").style.display = "";
+    if(url.indexOf("sessionTimeout")!=-1)
+        document.getElementById("messSession").style.display = "";
+*/
+}
+
+function changeLang() {
+    var lang = document.getElementById('userLang').value;
+    setCookie('kimchiLang', lang, 365);
+    window.location.reload();
+}
+
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body class="login" onload="init()"&gt;
+
+&lt;div class="header"&gt;
+    &lt;div class="lang"&gt;
+    &lt;label&gt;$_("Language"):&lt;/label&gt;
+    &lt;select id="userLang" onchange="changeLang()"&gt;
+        &lt;option value="en_US"&gt;English (US)&lt;/option&gt;
+        &lt;option value="zh_CN"&gt;&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;&lt;/option&gt;
+        &lt;option value="pt_BR"&gt;Portugu&ecirc;s (Brasil)&lt;/option&gt;
+    &lt;/select&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div class="content-pane"&gt;
+    &lt;div class="trademark"&gt;&lt;span class="logo"&gt;&lt;/span&gt;&lt;span class="name"&gt;Kimchi&lt;/span&gt;&lt;span class="version"&gt;1.2&lt;/span&gt;&lt;/div&gt;
+    &lt;div class="message-area"&gt;
+        &lt;div id="messUserPass" class="item text" style="display: none;"&gt;$_("User Name or password is incorrect.")&lt;/div&gt;
+        &lt;div id="messSession" class="item text" style="display: none;"&gt;$_("Session timeout, please re-login.")&lt;/div&gt;
+        &lt;div id="messWait" class="item progress-indicator" style="display: none;"&gt;
+            &lt;img src="images/progressing.gif" class="progress-icon"&gt;&lt;span class="progress-text"&gt;$_("Processing")...&lt;/span&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    &lt;div class="hint"&gt;$_("Sign in with your linux account")&lt;/div&gt;
+    &lt;div class="field-area"&gt;
+        &lt;form name="login" action="/login?next=$getVar('data.next', '/')" method="POST" onsubmit="return validateForm()"&gt;
+        &lt;input type="hidden" name="next" value="$getVar('data.next', '/')"&gt;
+        &lt;input type="text" name="username" placeholder="$_("User Name")" class="text-field" autofocus&gt;
+        &lt;input type="password" name="password" placeholder="$_("Password")" class="text-field"&gt;
+        &lt;input type="submit" value="$_("Sign In")" class="button"&gt;
+        &lt;/form&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</pre>
        </blockquote>
        <br>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Thanks and best regards!

Sheldon Feng(&#20911;&#23569;&#21512;)<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
IBM Linux Technology Center</pre>
  </body>
</html>