Ejemplo n.º 1
0
def send_reset_email(request):
	if request.POST:
		username = request.POST['username']

		try:
			account = User.objects.get(username=username)
			user_profile = Profile.objects.get(account=account)
		except:
			account = None
			user_profile = None

		if user_profile and username:
			reset = PasswordReset.objects.create(user=user_profile.account)

			password_reset_link =  APP_SERVER+reset.generate_reset_link()
		
			template = '../../static/templates/emails/password_reset.html'
			context = {'profile' : user_profile,'password_reset_link' : password_reset_link}
			html_email = loader.render_to_string(template,context)

			send_password_reset_email.delay(
				str(user_profile.organization+' Fundraiser'), 
				'Jose Madrid Salsa fundraising <*****@*****.**>',
				[user_profile.email],
				html_email
			)
			messages.success(request,'Password reset email sent.')
		else:
			messages.error(request,'Email and Username does not exist in our system. Please call our back office.')


	return HttpResponseRedirect(reverse('home'))
Ejemplo n.º 2
0
	def test_password_reset(self):
		password_reset_link =  'http://*****:*****@josemadridsalsa.com>',
			[self.profile.email],
			html_email
		)