Pimp up the login page and default / to /login #5

Merged
merged 2 commits into from Jun 11, 2012
View
8 src/py/iqpapp/authenticate_user.py
@@ -28,7 +28,7 @@ def wrapper(*args, **kwargs):
c = request.client_session
user = request.client_user_object
if not user:
- return redirect(url_for('welcome'))
+ return redirect(url_for('login'))
else:
result = fn(*args, **kwargs)
return result
@@ -39,7 +39,7 @@ def wrapper(*args, **kwargs):
request = args[0]
user = request.client_user_object
if not user:
- return redirect(url_for('welcome'))
+ return redirect(url_for('login'))
else:
user_id = user.user_id
category_name = kwargs['c_name']
@@ -62,7 +62,7 @@ def wrapper(*args, **kwargs):
request = args[0]
user = request.client_user_object
if not user:
- return redirect(url_for('welcome'))
+ return redirect(url_for('login'))
else:
user_id = user.user_id
subcategory_name = kwargs['sc_name']
@@ -106,7 +106,7 @@ def logout(request):
c = request.client_session
if "user_id" in c:
del c["user_id"]
- return redirect(url_for('welcome'))
+ return redirect(url_for('login'))
@authenticateuser
@expose('/register/')
View
49 src/py/iqpapp/templates/login.html
@@ -1,12 +1,37 @@
-{% extends 'base.html' %}
-{% block title %}
-Login
-{% endblock %}
-{% block content %}
- <h2>Login</h2>
- <form method="post" action=" {{ url_for('login') }} ">
- <p>Email: <input name="email" type="text"></p>
- <p>Password: <input name="password" type="password"></p>
- <p><input type="submit" value="Submit"></p>
- </form>
-{% endblock %}
+<!DOCTYPE html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta charset="utf-8">
+
+ <title>IQ Dashboard</title>
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
+ <meta name="format-detection" content="telephone=no, email=no">
+ <meta name="apple-mobile-web-app-capable" content="no">
+ <style type="text/css">html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-collapse:collapse;border-spacing:0}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}input,select{vertical-align:middle}html{-webkit-text-size-adjust:none;-ms-text-size-adjust:none}body{font:13px/1.231 sans-serif;*font-size:small}select,input,textarea,button{font:99% sans-serif}pre,code,kbd,samp{font-family:monospace,sans-serif}a:hover,a:active{outline:0}ul,ol{margin-left:2em}ol{list-style-type:decimal}nav ul,nav li{margin:0;list-style:none;list-style-image:none}small{font-size:85%}strong,th{font-weight:bold}td{vertical-align:top}sub,sup{font-size:75%;line-height:0;position:relative}sup{top:-0.5em}sub{bottom:-0.25em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word;padding:15px}textarea{overflow:auto}.iem7 legend{margin-left:-7px}input[type="radio"]{vertical-align:text-bottom}input[type="checkbox"]{vertical-align:bottom}.iem7 input[type="checkbox"]{vertical-align:baseline}label,input[type="button"],input[type="submit"],input[type="image"],button{cursor:pointer}button,input,select,textarea{margin:0}input:invalid,textarea:invalid{border-radius:1px;-moz-box-shadow:0 0 5px red;-webkit-box-shadow:0 0 5px red;box-shadow:0 0 5px red}.no-boxshadow input:invalid,.no-boxshadow textarea:invalid{background-color:#f0dddd}button{width:auto;overflow:visible}.iem7 img{-ms-interpolation-mode:bicubic}body,select,input,textarea{color:#444}h1,h2,h3,h4,h5,h6{font-weight:bold}a,a:active,a:visited{color:#607890}a:hover{color:#036}.nocallout{-webkit-touch-callout:none}.ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}textarea.contenteditable{-webkit-appearance:none}.gifhidden{position:absolute;left:-100%}.muted,.source,.timestamp{color:#999490}.inverted .muted,.inverted .source,.inverted .timestamp{color:#efefef}html{font-family:"Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif}a{color:#1c6ba1;text-decoration:none}a:visited{color:#1c6ba1}a:hover{color:#1c6ba1}a:active{color:#1c6ba1}legend{border-bottom:1px solid #222;padding-bottom:4px;padding:12px 0 6px;width:100%}label{display:block;overflow:hidden}legend,label,fieldset,.controls{-webkit-margin-collapse:separate}label,.prefix{font-size:9.96px;font-weight:bold;margin:12px 0 6px;width:296px}input[type=email],input[type=search],input[type=number],input[type=url],input[type=password],input[type=color],input[type=range],input[type=date],input[type=month],input[type=week],input[type=time],input[type=datetime],input[type=datetime-local],input[type=text],select,textarea{border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;font-size:15.96px;padding:4px;width:280px}.prefix input[type=email],.prefix input[type=search],.prefix input[type=number],.prefix input[type=url],.prefix input[type=password],.prefix input[type=color],.prefix input[type=range],.prefix input[type=date],.prefix input[type=month],.prefix input[type=week],.prefix input[type=time],.prefix input[type=datetime],.prefix input[type=datetime-local],.prefix input[type=text],.prefix select,.prefix textarea{display:inline;float:none;margin:0;vertical-align:baseline}.prefix.http input[type=email],.prefix.http input[type=search],.prefix.http input[type=number],.prefix.http input[type=url],.prefix.http input[type=password],.prefix.http input[type=color],.prefix.http input[type=range],.prefix.http input[type=date],.prefix.http input[type=month],.prefix.http input[type=week],.prefix.http input[type=time],.prefix.http input[type=datetime],.prefix.http input[type=datetime-local],.prefix.http input[type=text],.prefix.http select,.prefix.http textarea{width:242px}.prefix{font-size:9.96px;font-weight:normal;margin:0;padding:0}input[required],.required input[type=email],.required input[type=search],.required input[type=number],.required input[type=url],.required input[type=password],.required input[type=color],.required input[type=range],.required input[type=date],.required input[type=month],.required input[type=week],.required input[type=time],.required input[type=datetime],.required input[type=datetime-local],.required input[type=text],.required select,.required textarea,.required[input]{border:1px solid red}.controls{overflow:hidden;margin:12px 0 6px;vertical-align:middle}.controls li,.controls div,.controls input[type=submit],.controls input[type=button]{background-image:-webkit-gradient(linear,left top,left bottom,from(#1f6a8d),to(#0e3e54));background-image:-moz-linear-gradient(top,#1f6a8d,#0e3e54);border:1px solid #5e5c59;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;display:block;float:left;margin:0 12px 0 0;height:35px;width:40px;display:block;overflow:hidden;text-indent:-999em;text-align:center}.controls li:last-of-type,.controls div:last-of-type{margin:0}.controls a:last-of-type li:last-of-type{margin:0}.controls a li:last-of-type{margin:0 12px 0 0}.controls .text,.controls input[type=submit].text,.controls input[type=button].text{background-image:-webkit-gradient(linear,left top,left bottom,from(#1f6a8d),to(#0e3e54));background-image:-moz-linear-gradient(top,#1f6a8d,#0e3e54);border:1px solid #0a2940;color:#fff;font-size:13.92px;line-height:35px;padding-left:12px;padding-right:12px;text-indent:0;font-weight:bold;width:auto}.controls .text.call-to-action,.controls input[type=submit].text.call-to-action,.controls input[type=button].text.call-to-action{background-image:-webkit-gradient(linear,left top,left bottom,from(#1f6a8d),to(#0e3e54));background-image:-moz-linear-gradient(top,#1f6a8d,#0e3e54);border:1px solid #0a2940;color:#fff}.controls .text.secondary,.controls input[type=submit].text.secondary,.controls input[type=button].text.secondary{background-image:-webkit-gradient(linear,left top,left bottom,from(#b0adab),to(#5d5b58));background-image:-moz-linear-gradient(top,#b0adab,#5d5b58);border:1px solid #5e5c59;color:#fff}.controls input[type=submit].text,.controls input[type=button].text{line-height:1}.controls .disabled{opacity:.5}.controls.active{background-image:-webkit-gradient(linear,left top,left bottom,from(#1f6a8d),to(#0e3e54));background-image:-moz-linear-gradient(top,#1f6a8d,#0e3e54);border:1px solid #0a2940;color:#fff}.controls.quadruple li,.controls.quadruple div{width:65px}.controls.triple li,.controls.triple div{width:90px}.controls.double li,.controls.double div{width:144px}.controls.double li.text,.controls.double div.text{width:120px}.controls.single.center{width:304px;margin:12px auto 6px auto}.controls.single li,.controls.single div,.controls.single input[type=submit].text{clear:both;display:block;width:278px}.controls.navigation li,.controls.navigation div{margin:0}.controls.navigation li:first-of-type,.controls.navigation div:first-of-type{border-bottom-right-radius:0;-moz-border-bottom-right-radius:0;-webkit-border-bottom-right-radius:0;border-top-right-radius:0;-moz-border-top-right-radius:0;-webkit-border-top-right-radius:0}.controls.navigation li:last-of-type,.controls.navigation div:last-of-type{border-bottom-left-radius:0;-moz-border-bottom-left-radius:0;-webkit-border-bottom-left-radius:0;border-top-left-radius:0;-moz-border-top-left-radius:0;-webkit-border-top-left-radius:0}#login{background-color:#333;background-image:-webkit-gradient(radial,center 10%,10,center 15%,200,from(#444),to(#000));color:#fff;height:100%}#login label{display:block;overflow:hidden;text-indent:-999em;position:fixed;top:-999em;left:-999em}#login-content{width:300px;margin:0 auto;padding:16px 0 300px}#login-content #password,#login-content #username{border-radius:12px;-moz-border-radius:12px;-webkit-border-radius:12px;margin:0;padding:10px 8px;width:264px;-webkit-appearance:none}#login-content #password{border-top-left-radius:0;border-top-right-radius:0;vertical-align:bottom;border-top:1px solid lightgrey}#login-content #username{border-bottom-left-radius:0;border-bottom-right-radius:0;vertical-align:top;border-bottom:0}#login-content #login-button{background:#058DC7; width:280px;text-shadow:0 1px 1px #000;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;margin:8px 0}#login-logo{margin:24px 0;height:29px;width:108px}.login_view{text-align:center}.controls{display:inline-block}.sign-up{margin-top:16px;color:#807b78}</style>
+ </head>
+
+ <body class="loaded headerless">
+ <div class="ui-mobile-viewport">
+ <div id="login" data-role="page" class="page ui-page ui-body-c ui-page-active active-page">
+ <div id="login-content" data-role="content" class="content">
+ <section class="login_view">
+ <canvas id="login-logo" height="29" width="108" style="width: 108px; height: 29px; ">IQP</canvas>
+ <form id="login_form" method="post" action=" {{ url_for('login') }}">
+ <label for="username">Email</label>
+
+ <input id="username" name="email" placeholder="Email" type="email" autocapitalize="off" autocomplete="off" autocorrect="off">
+ <label for="password">Password</label>
+ <input id="password" name="password" placeholder="Password" type="password">
+ <div class="controls single">
+ <input id="login-button" type="submit" value="Sign in" class="text">
+ </div>
+ </form>
+ <div id="login-message"></div>
+ <p class="sign-up"><a href="/">Home</a></p>
+ <p class="sign-up"><a href="/register">Register</a></p>
+ </section>
+ </div>
+ </div>
+ </div>
+</body></html>