From 0208d1fc505ec8ccfc8c18b407ca805aab170bc1 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 9 May 2010 23:53:04 +0100 Subject: [PATCH 1/4] Fixed password reset for QMS --- sso/services/qms/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sso/services/qms/__init__.py b/sso/services/qms/__init__.py index 4b6eb95..a7f4be9 100644 --- a/sso/services/qms/__init__.py +++ b/sso/services/qms/__init__.py @@ -79,7 +79,7 @@ class QMSService(BaseService): def enable_user(self, uid, password): """ Enable a user """ - pwhash, salt = self._gen_mw_hash(password) + pwhash, salt = self._gen_pwhash(password) self._dbcursor.execute(self.SQL_ENABLE_USER, [pwhash, salt, uid]) self._db.connection.commit() return True From e69b67f90b83809c607c53612dbe3223ae27b625 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 9 May 2010 23:56:39 +0100 Subject: [PATCH 2/4] Fixed password reset, now sets cert --- sso/services/qms/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sso/services/qms/__init__.py b/sso/services/qms/__init__.py index a7f4be9..9cf1ce3 100644 --- a/sso/services/qms/__init__.py +++ b/sso/services/qms/__init__.py @@ -16,7 +16,7 @@ class QMSService(BaseService): SQL_ADD_USER = r"INSERT INTO users (ssoid, Name, passhash, salt, Email, certificate) VALUES (%s, %s, %s, %s, %s, %s)" SQL_DIS_USER = r"UPDATE users SET passhash = '' WHERE ssoid = %s" - SQL_ENABLE_USER = r"UPDATE users SET passhash = %s, salt = %s WHERE ssoid = %s" + SQL_ENABLE_USER = r"UPDATE users SET passhash = %s, salt = %s, certificate = %s WHERE ssoid = %s" SQL_CHECK_USER = r"SELECT ssoid from users WHERE ssoid = %s" def __init__(self): @@ -79,8 +79,8 @@ class QMSService(BaseService): def enable_user(self, uid, password): """ Enable a user """ - pwhash, salt = self._gen_pwhash(password) - self._dbcursor.execute(self.SQL_ENABLE_USER, [pwhash, salt, uid]) + pwhash, salt, cert = self._gen_pwhash(password) + self._dbcursor.execute(self.SQL_ENABLE_USER, [pwhash, salt, cert, uid]) self._db.connection.commit() return True From 6ae35f8775a0908a7238f5c90d7f96fc56fbd758 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 10 May 2010 09:32:32 +0100 Subject: [PATCH 3/4] Fixes user application status update issue --- hr/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hr/views.py b/hr/views.py index 78e08f3..62440b6 100644 --- a/hr/views.py +++ b/hr/views.py @@ -157,7 +157,7 @@ def update_application(request, applicationid, status): app = get_object_or_404(Application, id=applicationid) # Allow admins and users that are setting the application as awaiting review - if hrstaff or (app.user == request.user and status == APPLICATION_STATUS_AWAITINGREVIEW): + if hrstaff or (app.user == request.user and int(status) == APPLICATION_STATUS_AWAITINGREVIEW): if not app.status == status: app.status = status app.save(user=request.user) From 64b4d736174163cdaefbdd91c8c9f16b355a630e Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 10 May 2010 14:06:30 +0100 Subject: [PATCH 4/4] Added documentation to the RedditAccount model, along with some inline tests --- reddit/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reddit/models.py b/reddit/models.py index 98838aa..c28a243 100644 --- a/reddit/models.py +++ b/reddit/models.py @@ -7,6 +7,15 @@ from datetime import datetime class RedditAccount(models.Model): """ Represents a User ID on Reddit + + This model can be populated by API update: + + >>> from reddit.models import RedditAccount + >>> mod = RedditAccount() + >>> mod.username = 'nik_doof' + >>> mod.api_update() + >>> mod.reddit_id + '1axok' """ user = models.ForeignKey(User, blank=True, null=True)