Every line of 'django email verification' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
49 def verify_email(request, token): 50 verifications = EmailVerification.objects.filter(token=token) 51 52 if has_verification_failed(verifications): 53 return render(request, 'redesign/email_verification_failed_new.html') 54 55 verification = verifications[0] 56 57 verification.verified = True 58 verification.save() 59 60 user = verification.user 61 62 if verification.email: # verifying change of email address 63 user.email = verification.email 64 user.save() 65 66 user.email_verifications.exclude(email=user.email).delete() 67 68 messages.success(request, 'Your email address was successfully verified, please log in.') 69 70 # copy newly verified user to secure salesforce db 71 add_to_salesforce(user) 72 73 if hasattr(user.userprofile, 'student'): 74 return HttpResponseRedirect(reverse_lazy('login_new')) 75 if hasattr(user.userprofile, 'teacher'): 76 return HttpResponseRedirect(reverse_lazy('onboarding-organisation')) 77 78 # default to homepage if something goes wrong 79 return HttpResponseRedirect(reverse_lazy('home_new'))
64 def emailChangeVerificationEmail(request, token): 65 return { 66 "subject": emailSubjectPrefix() + " : Email address verification needed", 67 "message": ( 68 "You are changing your email, please go to " 69 + request.build_absolute_uri( 70 reverse("verify_email", kwargs={"token": token}) 71 ) 72 + " to verify your new email address. If you are not part of Code for Life " 73 + "then please ignore this email. " 74 + emailBodySignOff(request) 75 ), 76 }
5 def activation_email(request, user, **kwargs): 6 """ 7 Side effect of updating is_active field to False 8 """ 9 user_email = utils.get_user_email(user) 10 assert user_email is not None 11 to = [user_email] 12 context = {'user': user} 13 context.update(kwargs) 14 settings.EMAIL['activation'](request, context).send(to) 15 16 user.is_active = False 17 user.save(update_fields=['is_active'])
36 def email_confirmed_handler(sender, request, email_address, **kwargs): 37 """ 38 Signal handler called when a user logged into the web app. 39 40 One idea is to retrieve the backend auth token and save it in the web 41 app for subsequent access, but we do not have easy access to the 42 django user object. 43 """ 44 print 'Email Confirmed signal for ', request.user.username
100 def password_reset_email(user, token_generator, use_https=False, domain=None, template=None, subject=None, sender=None): 101 domain = domain or htk_setting('HTK_DEFAULT_DOMAIN') 102 context = { 103 'user': user, 104 'email': user.profile.confirmed_email or user.email, 105 'protocol': use_https and 'https' or 'http', 106 'domain': domain, 107 'site_name': htk_setting('HTK_SITE_NAME'), 108 'reset_path': reverse(htk_setting('HTK_ACCOUNTS_RESET_PASSWORD_URL_NAME')), 109 'uid': int_to_base36(user.id), 110 'token': token_generator.make_token(user), 111 } 112 113 reset_uri = '%(protocol)s://%(domain)s%(reset_path)s?u=%(uid)s&t=%(token)s' % context 114 context['reset_uri'] = reset_uri 115 template = template or 'accounts/reset_password' 116 subject = (subject or htk_setting('HTK_ACCOUNT_EMAIL_SUBJECT_PASSWORD_RESET')) % context 117 send_email( 118 template=template, 119 subject=subject, 120 sender=sender, 121 to=[context['email']], 122 context=context 123 )
10 @main.route('/resend-email-verification') 11 @redirect_to_sign_in 12 def resend_email_verification(): 13 user = User.from_email_address(session['user_details']['email']) 14 user.send_verify_email() 15 return render_template('views/resend-email-verification.html', email=user.email_address)
383 @override_settings( 384 REST_REGISTRATION={ 385 'REGISTER_EMAIL_VERIFICATION_URL': REGISTER_EMAIL_VERIFICATION_URL, 386 } 387 ) 388 def test_tampered_email(self): 389 self.setup_user() 390 signer = RegisterEmailSigner({ 391 'user_id': self.user.pk, 392 'email': self.new_email, 393 }) 394 data = signer.get_signed_data() 395 data['email'] = 'p' + data['email'] 396 request = self.create_post_request(data) 397 response = self.view_func(request) 398 self.assert_invalid_response(response, status.HTTP_400_BAD_REQUEST) 399 self.user.refresh_from_db() 400 self.assertEqual(self.user.email, self.email)
243 def clean_email(self): 244 value = self.cleaned_data["email"] 245 value = get_adapter().clean_email(value) 246 if app_settings.UNIQUE_EMAIL: 247 if value and email_address_exists(value): 248 self.raise_duplicate_email_error() 249 return value
97 @classmethod 98 def send_verification_email(self,user_email, token): 99 config = db.GqlQuery("SELECT * FROM EmailConfig").get() 100 if config is None: 101 return False 102 msg = "Please click the following link in order to verify your account: {0}".format(str(config.url_prefix)+"/verify?user_email={0}&signup_token={1}".format(user_email, token)) 103 status = self.send_email(user_email,"StochSS registration verification", msg) 104 if status: 105 return True 106 else: 107 return False
164 @transaction.atomic 165 def send_password_reset_verification_code(self): 166 VerificationCode.objects.filter(user=self, type=VerificationCode.PASSWORD_RESET).delete() 167 verification_code = VerificationCode.objects.create(user=self, type=VerificationCode.PASSWORD_RESET) 168 prepare_passwordreset_request_email(self, verification_code).send()