X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fjoinview.py;h=d28daba9442f5544bf239a5fa7a99f1cb291e5be;hb=93a803c3c30eb83d921ce7aad2684a7847d61ba9;hp=8356dec7bc1c94c784ca0c168918d49e43a261de;hpb=fdd9b516fcb287a9451874c04fd946bef9803c13;p=myslice.git diff --git a/portal/joinview.py b/portal/joinview.py index 8356dec7..d28daba9 100644 --- a/portal/joinview.py +++ b/portal/joinview.py @@ -74,6 +74,8 @@ class JoinView (FreeAccessView, ThemeView): #prepare user_hrn split_email = reg_email.split("@")[0] split_email = split_email.replace(".", "_") + # Replace + by _ => more convenient for testing and validate with a real email + split_email = split_email.replace("+", "_") user_hrn = reg_auth + '.' + split_email UserModel = get_user_model() @@ -91,6 +93,16 @@ class JoinView (FreeAccessView, ThemeView): errors.append('First Name may contain only letters, numbers, spaces and @/./+/-/_ characters.') if (re.search(r'^[\w+\s.@+-]+$', reg_lname) == None): errors.append('Last Name may contain only letters, numbers, spaces and @/./+/-/_ characters.') + if (re.search(r'^[A-Za-z0-9_ ]*$', reg_site_name) == None): + errors.append('Name of organization may contain only letters, numbers, and underscore.') + if (re.search(r'^[A-Za-z ]*$', reg_address_city) == None): + errors.append('City may contain only letters.') + if (re.search(r'^[A-Za-z ]*$', reg_address_country) == None): + errors.append('Country may contain only letters.') + if (re.search(r'^[A-Za-z0-9]*$', reg_site_abbreviated_name) == None): + errors.append('Shortname may contain only letters and numbers') + if (re.search(r'^[0-9]*$', reg_phone) == None): + errors.append('Phone number may contain only numbers.') #if (re.search(r'^\w+$', reg_site_authority) == None): # errors.append('Site Authority may contain only letters or numbers.') # checking in django_db !! @@ -108,18 +120,15 @@ class JoinView (FreeAccessView, ThemeView): errors.append('Email already registered in Manifold. Please provide a new email address.') # XXX TODO: Factorize with portal/accountview.py +# XXX TODO: Factorize with portal/registrationview.py +# XXX TODO: Factorize with portal/joinview.py # if 'generate' in request.POST['question']: from Crypto.PublicKey import RSA private = RSA.generate(1024) - private_key = json.dumps(private.exportKey()) - public = private.publickey() - public_key = json.dumps(public.exportKey(format='OpenSSH')) - + private_key = private.exportKey() + public_key = private.publickey().exportKey(format='OpenSSH') # Saving to DB - account_config = '{"user_public_key":'+ public_key + ', "user_private_key":'+ private_key + ', "user_hrn":"'+ user_hrn + '"}' auth_type = 'managed' - public_key = public_key.replace('"', ''); - private_key = private_key.replace('"', ''); if not errors: reg_password = request.POST['pi_password']