diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e6760e..53ae2bd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 =================== diff --git a/cas_server/__init__.py b/cas_server/__init__.py index 43c6d63..0ffa524 100644 --- a/cas_server/__init__.py +++ b/cas_server/__init__.py @@ -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' diff --git a/cas_server/forms.py b/cas_server/forms.py index cc6b2b0..3c42bab 100644 --- a/cas_server/forms.py +++ b/cas_server/forms.py @@ -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 diff --git a/cas_server/utils.py b/cas_server/utils.py index 8817b22..78fde92 100644 --- a/cas_server/utils.py +++ b/cas_server/utils.py @@ -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 (