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) 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) diff --git a/sso/services/qms/__init__.py b/sso/services/qms/__init__.py index 4b6eb95..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_mw_hash(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