[ckan-changes] [okfn/ckan] b23b35: [release-v1.6.1][#2315]: Changed cookie expirt def...
GitHub
noreply at github.com
Fri Apr 20 11:01:25 UTC 2012
Branch: refs/heads/release-v1.6.1
Home: https://github.com/okfn/ckan
Commit: b23b35748ab3bd78cfd841423ccbec53a297331c
https://github.com/okfn/ckan/commit/b23b35748ab3bd78cfd841423ccbec53a297331c
Author: David Read <david.read at okfn.org>
Date: 2012-04-20 (Fri, 20 Apr 2012)
Changed paths:
M ckan/templates/user/login.html
M ckan/tests/functional/test_user.py
Log Message:
-----------
[release-v1.6.1][#2315]: Changed cookie expirt default to 2 years (from 50) and give option to just be session length.
diff --git a/ckan/templates/user/login.html b/ckan/templates/user/login.html
index 9efdb87..7b646b9 100644
--- a/ckan/templates/user/login.html
+++ b/ckan/templates/user/login.html
@@ -20,23 +20,36 @@
<py:def function="page_heading">Login to ${g.site_title}</py:def>
<div py:match="content">
-
- <form action="${h.url_for('/login_generic')}" method="post" class="simple-form" id="login">
+
+ <form action="${h.url_for('/login_generic')}" method="post" class="form-horizontal" id="login">
<fieldset>
<!--legend i18n:msg="site_title">Login</legend-->
+ <div class="control-group">
+ <label class="control-label" for="login">Login:</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" name="login" id="login" value="" />
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label" for="password">Password:</label>
+ <div class="controls">
+ <input type="password" name="password" id="password" value="" />
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label" for="remember">Remember me:</label>
+ <!-- optional 2 year cookie expiry -->
+ <div class="controls">
+ <input type="checkbox" name="remember" id="remember" value="63072000" checked="checked"/>
+ </div>
+ </div>
- <label for="login">Login:</label>
- <input type="text" name="login" value="" />
- <br/>
- <label for="password">Password:</label>
- <input type="password" name="password" value="" />
- <!-- 50 year timeout -->
- <input type="hidden" name="remember" value="1576800000" />
- <br/>
+ <div class="form-actions">
+ <button name="s" id="s" type="submit" class="btn btn-primary">Sign In</button>
+ —
+ <a href="${h.url_for('reset')}">Forgot your password?</a>
+ </div>
</fieldset>
- <input name="s" id="s" type="submit" class="btn primary" value="Sign In"/>
- —
- <a href="${h.url_for('reset')}">Forgot your password?</a>
</form>
<br/>
<!-- Simple OpenID Selector -->
diff --git a/ckan/tests/functional/test_user.py b/ckan/tests/functional/test_user.py
index 5ab1efc..eb44bd9 100644
--- a/ckan/tests/functional/test_user.py
+++ b/ckan/tests/functional/test_user.py
@@ -168,11 +168,14 @@ def test_login(self):
fv = res.forms['login']
fv['login'] = str(username)
fv['password'] = str(password)
+ fv['remember'] = False
res = fv.submit()
# check cookies set
cookies = self._get_cookie_headers(res)
assert cookies
+ for cookie in cookies:
+ assert not 'max-age' in cookie.lower(), cookie
# first get redirected to user/logged_in
assert_equal(res.status, 302)
@@ -206,6 +209,32 @@ def test_login(self):
print res
assert 'testlogin' in res.body, res.body
+ def test_login_remembered(self):
+ # create test user
+ username = u'testlogin2'
+ password = u'letmein'
+ CreateTestData.create_user(name=username,
+ password=password)
+ user = model.User.by_name(username)
+
+ # do the login
+ offset = url_for(controller='user', action='login')
+ res = self.app.get(offset)
+ fv = res.forms['login']
+ fv['login'] = str(username)
+ fv['password'] = str(password)
+ fv['remember'] = True
+ res = fv.submit()
+
+ # check cookies set
+ cookies = self._get_cookie_headers(res)
+ assert cookies
+ # check cookie is remembered via Max-Age and Expires
+ # (both needed for cross-browser compatibility)
+ for cookie in cookies:
+ assert 'Max-Age=63072000;' in cookie, cookie
+ assert 'Expires=' in cookie, cookie
+
def test_login_wrong_password(self):
# create test user
username = u'testloginwrong'
================================================================
Commit: 879c424f4a879a1e044d523cecf0addcc5cbd75e
https://github.com/okfn/ckan/commit/879c424f4a879a1e044d523cecf0addcc5cbd75e
Author: David Read <david.read at okfn.org>
Date: 2012-04-20 (Fri, 20 Apr 2012)
Changed paths:
M ckan/templates/tag/index.html
M ckan/templates/user/list.html
M ckan/templates/user/login.html
M ckan/templates/user/logout.html
Log Message:
-----------
[merge]
diff --git a/ckan/templates/tag/index.html b/ckan/templates/tag/index.html
index 9aa3d61..50e44f7 100644
--- a/ckan/templates/tag/index.html
+++ b/ckan/templates/tag/index.html
@@ -8,9 +8,9 @@
<div py:match="content">
<h2>Tags</h2>
- <form id="tag-search" action="" method="GET">
+ <form class="form-inline" id="tag-search" action="" method="GET">
<input type="text" id="q" name="q" value="${c.q}" />
- <input type="submit" name="search" value="Search »" />
+ <input class="btn btn-primary" type="submit" name="search" value="Search »" />
</form>
<hr />
diff --git a/ckan/templates/user/list.html b/ckan/templates/user/list.html
index 2213db8..712b100 100644
--- a/ckan/templates/user/list.html
+++ b/ckan/templates/user/list.html
@@ -8,9 +8,10 @@
<py:match path="primarysidebar">
<li class="widget-container widget_text">
- <form id="user-search" class="user-search" action="" method="GET">
- <input type="text" id="q" name="q" value="${c.q}" />
- <input type="submit" class="btn btn-small" name="" value="Search »" />
+ <h3>Search Users</h3>
+ <form id="user-search" class="form-inline user-search" action="" method="GET">
+ <input type="text" class="input-medium" id="q" name="q" value="${c.q}" />
+ <input type="submit" class="btn btn-small btn-primary" name="" value="Search »" />
</form>
<p py:if="c.q" i18n:msg="item_count">
<strong>${c.page.item_count}</strong> users found.
diff --git a/ckan/templates/user/login.html b/ckan/templates/user/login.html
index 7b646b9..9d4c365 100644
--- a/ckan/templates/user/login.html
+++ b/ckan/templates/user/login.html
@@ -18,6 +18,7 @@
<py:def function="page_title">Login - User</py:def>
<py:def function="page_heading">Login to ${g.site_title}</py:def>
+ <py:def function="body_class">no-sidebar</py:def>
<div py:match="content">
diff --git a/ckan/templates/user/logout.html b/ckan/templates/user/logout.html
index e40ec5c..0f37272 100644
--- a/ckan/templates/user/logout.html
+++ b/ckan/templates/user/logout.html
@@ -6,6 +6,7 @@
<py:def function="page_title">Logout</py:def>
<py:def function="page_heading">Logout from ${g.site_title}</py:def>
+ <py:def function="body_class">no-sidebar</py:def>
<div py:match="content">
<p>You have logged out successfully.</p>
================================================================
Compare: https://github.com/okfn/ckan/compare/356cd32...879c424
More information about the ckan-changes
mailing list