Merge pull request #15 from nitmir/dev

Update version to 0.7.3

Added
-----
* Add autofocus to the username input on the login page

Fixed
-----
* Really pick the last version on Pypi for new version checking.
  We were only sorting version string lexicographically and it would have break when
  we reach version 0.10.N or 0.N.10
* Only check for valid username/password if username and password POST fields are posted.
  This fix a bug where posting without it raise a exception are None where passed for
  username/password verification.
This commit is contained in:
Valentin Samir 2016-09-07 18:30:03 +02:00 committed by GitHub
commit f2efa86721
4 changed files with 33 additions and 13 deletions

View File

@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file.
.. contents:: Table of Contents
:depth: 2
v0.7.3 - 2016-09-07
===================
Added
-----
* Add autofocus to the username input on the login page
Fixed
-----
* Really pick the last version on Pypi for new version checking.
We were only sorting version string lexicographically and it would have break when
we reach version 0.10.N or 0.N.10
* Only check for valid username/password if username and password POST fields are posted.
This fix a bug where posting without it raise a exception are None where passed for
username/password verification.
v0.7.2 - 2016-08-31
===================

View File

@ -11,7 +11,7 @@
"""A django CAS server application"""
#: version of the application
VERSION = '0.7.2'
VERSION = '0.7.3'
#: path the the application configuration class
default_app_config = 'cas_server.apps.CasAppConfig'

View File

@ -100,7 +100,10 @@ class UserCredential(BaseLogin):
Form used on the login page to retrive user credentials
"""
#: The user username
username = forms.CharField(label=_('username'))
username = forms.CharField(
label=_('username'),
widget=forms.TextInput(attrs={'autofocus': 'autofocus'})
)
#: The user password
password = forms.CharField(label=_('password'), widget=forms.PasswordInput)
#: A checkbox to ask to be warn before emiting a ticket for another service
@ -119,13 +122,14 @@ class UserCredential(BaseLogin):
:rtype: dict
"""
cleaned_data = super(UserCredential, self).clean()
auth = utils.import_attr(settings.CAS_AUTH_CLASS)(cleaned_data.get("username"))
if auth.test_password(cleaned_data.get("password")):
cleaned_data["username"] = auth.username
else:
raise forms.ValidationError(
_(u"The credentials you provided cannot be determined to be authentic.")
)
if "username" in cleaned_data and "password" in cleaned_data:
auth = utils.import_attr(settings.CAS_AUTH_CLASS)(cleaned_data["username"])
if auth.test_password(cleaned_data["password"]):
cleaned_data["username"] = auth.username
else:
raise forms.ValidationError(
_(u"The credentials you provided cannot be determined to be authentic.")
)
return cleaned_data

View File

@ -653,7 +653,8 @@ def check_password(method, password, hashed_password, charset):
def decode_version(version):
"""
decode a version string following version semantic http://semver.org/ input a tuple of int
decode a version string following version semantic http://semver.org/ input a tuple of int.
It will work as long as we do not use pre release versions.
:param unicode version: A dotted version
:return: A tuple a int
@ -683,9 +684,7 @@ def last_version():
try:
req = requests.get(settings.CAS_NEW_VERSION_JSON_URL)
data = json.loads(req.text)
versions = list(data["releases"].keys())
versions.sort()
version = versions[-1]
version = data["info"]["version"]
last_version._cache = (time.time(), version, True)
return version
except (