mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Merge branch 'master' of ssh://dev.dredd.it/dreddit-auth
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user