From 990f00fe3c98fe34881687396ad22bb87226b25a Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 6 Sep 2016 11:55:54 +0200 Subject: [PATCH 1/4] Add autofocus to the username input on the login page --- CHANGELOG.rst | 8 ++++++++ cas_server/forms.py | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e6760e..e0b0c48 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file. .. contents:: Table of Contents :depth: 2 +Unreleased +========== + +Added +----- +* Add autofocus to the username input on the login page + + v0.7.2 - 2016-08-31 =================== diff --git a/cas_server/forms.py b/cas_server/forms.py index cc6b2b0..ffa6f35 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 From 868a06ea3f1b658866b15989d00a441b733f1671 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 6 Sep 2016 12:02:43 +0200 Subject: [PATCH 2/4] 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 --- CHANGELOG.rst | 6 ++++++ cas_server/utils.py | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e0b0c48..5d15330 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,12 @@ 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 + v0.7.2 - 2016-08-31 =================== 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 ( From 216f38db14241569270042f4186e11b9c8a7c37b Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Wed, 7 Sep 2016 17:13:42 +0200 Subject: [PATCH 3/4] Only check for valid username/password if username and password POST fields are posted. --- CHANGELOG.rst | 3 +++ cas_server/forms.py | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5d15330..34f62e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,9 @@ 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/forms.py b/cas_server/forms.py index ffa6f35..3c42bab 100644 --- a/cas_server/forms.py +++ b/cas_server/forms.py @@ -122,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 From 8a7ffd817254f3bd7c304a1b41b9483df88b7102 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Wed, 7 Sep 2016 17:25:28 +0200 Subject: [PATCH 4/4] Update version to 0.7.3 --- CHANGELOG.rst | 4 ++-- cas_server/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 34f62e6..53ae2bd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,8 +6,8 @@ All notable changes to this project will be documented in this file. .. contents:: Table of Contents :depth: 2 -Unreleased -========== +v0.7.3 - 2016-09-07 +=================== Added ----- 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'