X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fregistrationview.py;h=f7314473c1e3eabd883e74dfc97c5865e4b9febe;hb=7b8e398d8ecb65b1a860e8651f3d2bf5bbace539;hp=ab09c9f185aa585eef3da88a1e098437d503bfea;hpb=31b87e762d7430afeb81cf45f0b8c086cda91095;p=unfold.git diff --git a/portal/registrationview.py b/portal/registrationview.py index ab09c9f1..f7314473 100644 --- a/portal/registrationview.py +++ b/portal/registrationview.py @@ -1,6 +1,7 @@ import os.path, re import json -from random import randint +from random import randint +from hashlib import md5 from django.views.generic import View from django.template.loader import render_to_string @@ -46,7 +47,7 @@ class RegistrationView (FreeAccessView, ThemeView): page = Page(wsgi_request) page.add_js_files ( [ "js/jquery.validate.js", "js/my_account.register.js" ] ) page.add_css_files ( [ "css/onelab.css", "css/registration.css" ] ) - page.add_css_files ( [ "http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] ) + page.add_css_files ( [ "https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] ) if method == 'POST': # The form has been submitted @@ -55,13 +56,19 @@ class RegistrationView (FreeAccessView, ThemeView): current_site = Site.objects.get_current() current_site = current_site.domain + post_email = wsgi_request.POST.get('email','').lower() + salt = randint(1,100000) + email_hash = md5(str(salt)+post_email).hexdigest() + #email_hash = md5(post_email).digest().encode('base64')[:-1] user_request = { 'first_name' : wsgi_request.POST.get('firstname', ''), 'last_name' : wsgi_request.POST.get('lastname', ''), 'authority_hrn' : wsgi_request.POST.get('authority_hrn', ''), - 'email' : wsgi_request.POST.get('email', '').lower(), + 'email' : post_email, 'password' : wsgi_request.POST.get('password', ''), - 'current_site' : current_site + 'current_site' : current_site, + 'email_hash' : email_hash, + 'validation_link': 'https://' + current_site + '/portal/email_activation/'+ email_hash } # Construct user_hrn from email (XXX Should use common code)