Commit 8d3f32bd98f82c40b9a6eae4374abd1e8dfa92c9
Committed by
Sergio Oliveira
1 parent
aef211b9
Exists in
master
and in
39 other branches
Used browserid's default algorythm to create user
The default algorythm generates a hash to save in database Signed-off-by: Carlos Oliveira <carlospecter@gmail.com> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Showing
1 changed file
with
2 additions
and
4 deletions
Show diff stats
colab/accounts/auth.py
1 | import re | 1 | import re |
2 | 2 | ||
3 | -from django_browserid.auth import BrowserIDBackend | 3 | +from django_browserid.auth import BrowserIDBackend, default_username_algo |
4 | 4 | ||
5 | 5 | ||
6 | class ColabBrowserIDBackend(BrowserIDBackend): | 6 | class ColabBrowserIDBackend(BrowserIDBackend): |
@@ -8,11 +8,9 @@ class ColabBrowserIDBackend(BrowserIDBackend): | @@ -8,11 +8,9 @@ class ColabBrowserIDBackend(BrowserIDBackend): | ||
8 | return self.User.objects.filter(emails__address=email) | 8 | return self.User.objects.filter(emails__address=email) |
9 | 9 | ||
10 | def create_user(self, email): | 10 | def create_user(self, email): |
11 | - username = "colab_" + re.split('@', email)[0] | 11 | + username = default_username_algo(email) |
12 | password = None | 12 | password = None |
13 | extra_fields = { | 13 | extra_fields = { |
14 | - 'first_name': "Colab", | ||
15 | - 'last_name': "Colab", | ||
16 | 'needs_update': True | 14 | 'needs_update': True |
17 | } | 15 | } |
18 | 16 |