From d1eec9bcf4fb5fb760e20a9ee03ad217ecc779f7 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Mon, 19 Nov 2012 11:34:31 -0500 Subject: [PATCH] add a salt. using user.id since that's handy. --- common/djangoapps/student/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 4c91682ca6..5975853a21 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -201,9 +201,10 @@ def unique_id_for_user(user): Currently happens to be implemented as a sha1 hash of the username (and thus assumes that usernames don't change). """ - return sha1(user.username).hexdigest() - - + # Using the user id as the salt because it's sort of random, and is already + # in the db. + salt = str(user.id) + return sha1(salt + user.username).hexdigest() ## TODO: Should be renamed to generic UserGroup, and possibly