- #get_email = PendingUser.objects.get(email)
- if PendingUser.objects.filter(email__iexact=request.POST['email']):
- return HttpResponse("Email Already exist")
+ #get_email = PendingUser.objects.get(email)
+ reg_fname = request.POST['firstname']
+ reg_lname = request.POST['lastname']
+ reg_aff = request.POST['affiliation']
+ reg_email = request.POST['email'].lower()
+
+ #POST value validation
+ if (re.search(r'^[\w+\s.@+-]+$', reg_fname)==None):
+ return HttpResponse("Only Letters, Numbers, - and _ allowd in First Name")
+ if (re.search(r'^[\w+\s.@+-]+$', reg_lname) == None):
+ return HttpResponse("Only Letters, Numbers, - and _ is allowed in Last name")
+ if (re.search(r'^[\w+\s.@+-]+$', reg_aff) == None):
+ return HttpResponse("Only Letters, Numbers and _ is allowed in Affiliation")
+ if PendingUser.objects.filter(email__iexact=reg_email):
+ return HttpResponse("Email Already exists")