REG: user_hrn unique [using random numbers at the end]
[myslice.git] / portal / registrationview.py
index e068aec..c966b52 100644 (file)
@@ -1,5 +1,6 @@
 import os.path, re
 import json
+from random import randint
 
 from django.core.mail           import send_mail
 from django.contrib.auth.models import User
@@ -74,7 +75,7 @@ class RegistrationView (FreeAccessView):
             #prepare user_hrn 
             split_email = reg_email.split("@")[0] 
             split_email = split_email.replace(".", "_")
-            user_hrn = reg_auth + '.' + split_email
+            user_hrn = reg_auth + '.' + split_email+ str(randint(1,1000000))
             
             UserModel = get_user_model()
 
@@ -169,12 +170,13 @@ class RegistrationView (FreeAccessView):
                     'email'         : reg_email,
                     'user_hrn'      : user_hrn,
                     'public_key'    : public_key,
-                    'cc_myself'     : True # form.cleaned_data['cc_myself']
                     }
                 recipients = authority_get_pi_emails(request,reg_auth)
-
-                if ctx['cc_myself']:
-                    recipients.append(ctx['email'])
+                
+                # We don't need to send this email to user.
+                # it's for the PI only
+                #if ctx['cc_myself']:
+                #    recipients.append(ctx['email'])
 
                 msg = render_to_string('user_request_email.txt', ctx)
                 send_mail("Onelab New User request for %s submitted"%reg_email, msg, 'support@myslice.info', recipients)