From: gfawcett Date: Sat, 10 Jan 2009 21:02:08 +0000 (+0000) Subject: Tightened up login-form, welcome page X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=641ffd0014fe9f1662f43023a205ae766d2882c5;p=Syrup.git Tightened up login-form, welcome page * Added a tab-bar for anonymous users, and dropped the ugly right-side panel * Login form returns with an error instead of an ugly text-message * Logout returns you to the Home page * Cleaned up the tab-bar a bit; some items there really belong elsewhere. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@99 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/static/main.css b/conifer/static/main.css index f82e52c..b56585b 100644 --- a/conifer/static/main.css +++ b/conifer/static/main.css @@ -28,7 +28,9 @@ body { #brandheader { background-color: white; padding: 8; } -#header a { color: #fff; font-weight: bold; } +#header a { color: #fff; font-weight: bold; padding: 8 6; } +#header a.loginbutton { background-color: #a44; padding: 8 16; } +#header a:hover { background-color: #fb7; color: black; text-decoration: none; } #footer { margin-top: 12; @@ -99,3 +101,11 @@ a:hover { text-decoration: underline; } .topheading th { background-color: #ddf; } + + +p.todo, div.todo { background-color: #fdd; padding: 6; margin: 12; border-left: #d99 6px solid; } + + +.newsitem { + max-width: 600; +} \ No newline at end of file diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 9eb71f3..91c9285 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -11,24 +11,36 @@ from django.db.models import Q #------------------------------------------------------------ +# Authentication def auth_handler(request, path): if path == 'login/': if request.method == 'GET': - return g.render('auth/login.xhtml') + next=request.GET.get('next', '/syrup/') + if request.user.is_authenticated(): + return HttpResponseRedirect(next) + else: + return g.render('auth/login.xhtml', + next=request.GET.get('next'), + err=None # fixme, this shouldn't be + # necessary. Genshi should treat + # missing names as None, but something + # is wrong. + ) else: userid, password = request.POST['userid'], request.POST['password'] + next = request.POST['next'] user = authenticate(username=userid, password=password) if user is None: - return HttpResponse('invalid login.') + return g.render('auth/login.xhtml', err='Invalid username or password. Please try again.', next=next) elif not user.is_active: - return HttpResponse('disabled account.') + return g.render('auth/login.xhtml', err='Sorry, this account has been disabled.', next=next) else: login(request, user) - return HttpResponseRedirect(request.POST['next']) + return HttpResponseRedirect(request.POST.get('next', '/syrup/')) elif path == 'logout': logout(request) - return HttpResponse('Logged out. Thanks for coming!') + return HttpResponseRedirect('/syrup/') else: return HttpResponse('auth_handler: ' + path) diff --git a/conifer/templates/auth/login.xhtml b/conifer/templates/auth/login.xhtml index 74c7538..fad126a 100644 --- a/conifer/templates/auth/login.xhtml +++ b/conifer/templates/auth/login.xhtml @@ -14,7 +14,8 @@ title = 'Syrup E-Reserves: Please log in'

Please log in.

- + +
${err}
diff --git a/conifer/templates/master.xhtml b/conifer/templates/master.xhtml index c9d715d..962e535 100644 --- a/conifer/templates/master.xhtml +++ b/conifer/templates/master.xhtml @@ -45,9 +45,11 @@ app_name = 'Syrup E-Reserve System' Welcome! + Log In +
${select('*|text()')}
diff --git a/conifer/templates/tabbar.xhtml b/conifer/templates/tabbar.xhtml index 281efc2..abcdfc6 100644 --- a/conifer/templates/tabbar.xhtml +++ b/conifer/templates/tabbar.xhtml @@ -8,10 +8,10 @@ --> diff --git a/conifer/templates/tabbar_anonymous.xhtml b/conifer/templates/tabbar_anonymous.xhtml new file mode 100644 index 0000000..eb72aed --- /dev/null +++ b/conifer/templates/tabbar_anonymous.xhtml @@ -0,0 +1,13 @@ + + + + diff --git a/conifer/templates/welcome.xhtml b/conifer/templates/welcome.xhtml index b91869b..9da242e 100644 --- a/conifer/templates/welcome.xhtml +++ b/conifer/templates/welcome.xhtml @@ -9,12 +9,8 @@ title = 'Welcome!' ${title} -
-

Log in

-

Browse

-

News

-
+

${news.subject}

${news.body}
User ID: