
On 06/05/2014 01:10 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
V2 -> V3: improve when to show timeout message
V1 -> V2: when username or password is wrong, back to login page with an error message. when session time out, back to login page with an error message.
ShaoHe Feng (5): create a new login page redirect the URL to login page when session timeout or first login when login successfully, redirect to the last page. login page prompts error when username or password is wrong login page prompts error when session timeout
src/kimchi/auth.py | 51 +++++++++-- src/kimchi/config.py.in | 7 ++ src/kimchi/root.py | 38 ++++++-- src/kimchi/server.py | 2 + ui/images/progressing.gif | Bin 0 -> 1152 bytes ui/js/src/kimchi.main.js | 6 +- ui/pages/login.html.tmpl | 228 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 310 insertions(+), 22 deletions(-) create mode 100644 ui/images/progressing.gif create mode 100644 ui/pages/login.html.tmpl
The tests are failing with this patch set. ====================================================================== FAIL: test_accepts (test_rest.HttpsRestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 134, in test_accepts self.assertTrue('<!doctype html>' in resp.read().lower()) AssertionError: False is not true ====================================================================== FAIL: test_auth_bad_creds (test_rest.HttpsRestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1459, in test_auth_bad_creds self.assertEquals(401, resp.status) AssertionError: 401 != 303 ====================================================================== FAIL: test_auth_browser_no_httpba (test_rest.HttpsRestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1474, in test_auth_browser_no_httpba self.assertEquals(401, resp.status) AssertionError: 401 != 303 ====================================================================== FAIL: test_auth_protected (test_rest.HttpsRestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1453, in test_auth_protected self.assertEquals(401, resp.status) AssertionError: 401 != 303 ====================================================================== FAIL: test_auth_unprotected (test_rest.HttpsRestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1439, in test_auth_unprotected self.assertEquals(200, resp.status) AssertionError: 200 != 303 ====================================================================== FAIL: test_accepts (test_rest.RestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 134, in test_accepts self.assertTrue('<!doctype html>' in resp.read().lower()) AssertionError: False is not true ====================================================================== FAIL: test_auth_bad_creds (test_rest.RestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1459, in test_auth_bad_creds self.assertEquals(401, resp.status) AssertionError: 401 != 303 ====================================================================== FAIL: test_auth_browser_no_httpba (test_rest.RestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1474, in test_auth_browser_no_httpba self.assertEquals(401, resp.status) AssertionError: 401 != 303 ====================================================================== FAIL: test_auth_protected (test_rest.RestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1453, in test_auth_protected self.assertEquals(401, resp.status) AssertionError: 401 != 303 ====================================================================== FAIL: test_auth_unprotected (test_rest.RestTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_rest.py", line 1439, in test_auth_unprotected self.assertEquals(200, resp.status) AssertionError: 200 != 303 ====================================================================== FAIL: test_kimchi_config (test_config.ConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/alinefm/kimchi/tests/test_config.py", line 173, in test_kimchi_config self.assertEquals(kimchi_config, configObj) AssertionError: {'/libs': {'tools.expires.on': True, 'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/libs', 'tools.expires.secs': 31536000, 'tools.staticdir.on': True}, '/config/ui/tabs.xml': {'tools.nocache.on': True, 'tools.staticfile.on': True, 'tools.staticfile.filename': '/home/alinefm/kimchi/config/ui/tabs.xml'}, '/favicon.ico': {'tools.staticfile.on': True, 'tools.staticfile.filename': '/home/alinefm/kimchi/ui/images/logo.ico'}, '/js': {'tools.expires.on': True, 'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/js', 'tools.expires.secs': 31536000, 'tools.staticdir.on': True}, '/images': {'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/images', 'tools.staticdir.on': True}, '/spice.html': {'tools.kimchiauth.on': True}, '/login.html': {'tools.kimchisession.on': False}, '/': {'request.methods_with_bodies': ('POST', 'PUT'), 'tools.sessions.name': 'kimchi', 'tools.proxy.on': True, 'tools.sessions.locking': 'explicit', 'tools.sessions.httponly': True, 'tools.sessions.storage_type': 'ram', 'tools.sessions.timeout': 10, 'tools.sessions.on': True, 'tools.sessions.secure': True, 'tools.nocache.on': True, 'tools.kimchisession.on': True, 'tools.trailing_slash.on': False, 'tools.kimchiauth.on': False}, '/data/screenshots': {'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/data/screenshots', 'tools.staticdir.on': True}, '/help': {'tools.nocache.on': False, 'tools.staticdir.index': 'en_US/index.html', 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/pages/help', 'tools.staticdir.on': True}, '/vnc_auto.html': {'tools.kimchiauth.on': True}, '/kimchi-ui.html': {'tools.kimchiauth.on': True}, '/css': {'tools.expires.on': True, 'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/css', 'tools.expires.secs': 31536000, 'tools.staticdir.on': True}, '/data/debugreports': {'tools.kimchiauth.on': True, 'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/data/debugreports', 'tools.staticdir.content_types': {'xz': 'application/x-xz'}, 'tools.staticdir.on': True}} != {'/libs': {'tools.expires.on': True, 'tools.nocache.on': False, 'tools.expires.secs': 31536000, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/libs', 'tools.staticdir.on': True}, '/favicon.ico': {'tools.staticfile.on': True, 'tools.staticfile.filename': '/home/alinefm/kimchi/ui/images/logo.ico'}, '/js': {'tools.expires.on': True, 'tools.nocache.on': False, 'tools.expires.secs': 31536000, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/js', 'tools.staticdir.on': True}, '/images': {'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/images', 'tools.staticdir.on': True}, '/spice.html': {'tools.kimchiauth.on': True}, '/help': {'tools.nocache.on': False, 'tools.staticdir.index': 'en_US/index.html', 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/pages/help', 'tools.staticdir.on': True}, '/vnc_auto.html': {'tools.kimchiauth.on': True}, '/css': {'tools.expires.on': True, 'tools.nocache.on': False, 'tools.expires.secs': 31536000, 'tools.staticdir.dir': '/home/alinefm/kimchi/ui/css', 'tools.staticdir.on': True}, '/config/ui/tabs.xml': {'tools.nocache.on': True, 'tools.staticfile.on': True, 'tools.staticfile.filename': '/home/alinefm/kimchi/config/ui/tabs.xml'}, '/': {'request.methods_with_bodies': ('POST', 'PUT'), 'tools.sessions.name': 'kimchi', 'tools.proxy.on': True, 'tools.sessions.locking': 'explicit', 'tools.sessions.httponly': True, 'tools.sessions.storage_type': 'ram', 'tools.sessions.timeout': 10, 'tools.sessions.on': True, 'tools.sessions.secure': True, 'tools.nocache.on': True, 'tools.trailing_slash.on': False, 'tools.kimchiauth.on': False}, '/data/screenshots': {'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/data/screenshots', 'tools.staticdir.on': True}, '/data/debugreports': {'tools.kimchiauth.on': True, 'tools.nocache.on': False, 'tools.staticdir.dir': '/home/alinefm/kimchi/data/debugreports', 'tools.staticdir.content_types': {'xz': 'application/x-xz'}, 'tools.staticdir.on': True}} ---------------------------------------------------------------------- Ran 159 tests in 179.293s FAILED (failures=11) [09/Jun/2014:15:25:53] ENGINE Waiting for child threads to terminate... make[3]: *** [check-local] Error 1 make[3]: Leaving directory `/home/alinefm/kimchi/tests' make[2]: *** [check-am] Error 2 make[2]: Leaving directory `/home/alinefm/kimchi/tests' make[1]: *** [check] Error 2 make[1]: Leaving directory `/home/alinefm/kimchi/tests' make: *** [check-recursive] Error 1