Commit f2efa867 authored by Valentin Samir's avatar Valentin Samir Committed by GitHub

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.
parents 7a866792 8a7ffd81
Pipeline #588 passed with stage
in 7 minutes and 28 seconds
...@@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file. ...@@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file.
.. contents:: Table of Contents .. contents:: Table of Contents
:depth: 2 :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 v0.7.2 - 2016-08-31
=================== ===================
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"""A django CAS server application""" """A django CAS server application"""
#: version of the application #: version of the application
VERSION = '0.7.2' VERSION = '0.7.3'
#: path the the application configuration class #: path the the application configuration class
default_app_config = 'cas_server.apps.CasAppConfig' default_app_config = 'cas_server.apps.CasAppConfig'
...@@ -100,7 +100,10 @@ class UserCredential(BaseLogin): ...@@ -100,7 +100,10 @@ class UserCredential(BaseLogin):
Form used on the login page to retrive user credentials Form used on the login page to retrive user credentials
""" """
#: The user username #: The user username
username = forms.CharField(label=_('username')) username = forms.CharField(
label=_('username'),
widget=forms.TextInput(attrs={'autofocus': 'autofocus'})
)
#: The user password #: The user password
password = forms.CharField(label=_('password'), widget=forms.PasswordInput) password = forms.CharField(label=_('password'), widget=forms.PasswordInput)
#: A checkbox to ask to be warn before emiting a ticket for another service #: A checkbox to ask to be warn before emiting a ticket for another service
...@@ -119,13 +122,14 @@ class UserCredential(BaseLogin): ...@@ -119,13 +122,14 @@ class UserCredential(BaseLogin):
:rtype: dict :rtype: dict
""" """
cleaned_data = super(UserCredential, self).clean() cleaned_data = super(UserCredential, self).clean()
auth = utils.import_attr(settings.CAS_AUTH_CLASS)(cleaned_data.get("username")) if "username" in cleaned_data and "password" in cleaned_data:
if auth.test_password(cleaned_data.get("password")): auth = utils.import_attr(settings.CAS_AUTH_CLASS)(cleaned_data["username"])
cleaned_data["username"] = auth.username if auth.test_password(cleaned_data["password"]):
else: cleaned_data["username"] = auth.username
raise forms.ValidationError( else:
_(u"The credentials you provided cannot be determined to be authentic.") raise forms.ValidationError(
) _(u"The credentials you provided cannot be determined to be authentic.")
)
return cleaned_data return cleaned_data
......
...@@ -653,7 +653,8 @@ def check_password(method, password, hashed_password, charset): ...@@ -653,7 +653,8 @@ def check_password(method, password, hashed_password, charset):
def decode_version(version): 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 :param unicode version: A dotted version
:return: A tuple a int :return: A tuple a int
...@@ -683,9 +684,7 @@ def last_version(): ...@@ -683,9 +684,7 @@ def last_version():
try: try:
req = requests.get(settings.CAS_NEW_VERSION_JSON_URL) req = requests.get(settings.CAS_NEW_VERSION_JSON_URL)
data = json.loads(req.text) data = json.loads(req.text)
versions = list(data["releases"].keys()) version = data["info"]["version"]
versions.sort()
version = versions[-1]
last_version._cache = (time.time(), version, True) last_version._cache = (time.time(), version, True)
return version return version
except ( except (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment