Пример #1
0
def forgotPasswordSubmit( ):
	email=request.form['email']
	try:
		user = User.objects.get(emailAddress=email)    
	except DoesNotExist: 
		return render_template ("user/forgotPassword.html",userNotFound=True,emailSent=False)
	else:
		linkRef = str(user.id)[5:10]
		now = datetime.datetime.now().microsecond
		linkRef = linkRef + str(now)
		link = app.config["passwordResetPrefix"] + '?linkRef=' + linkRef;
		password_change_service.createPasswordChangeRequest(user.emailAddress,linkRef)

		email =  render_template ("emails/passwordResetEmail.html",link=link)

		email_service.send_mail(user.emailAddress,'*****@*****.**','Resupply Password Reset', 'html',email)

		email_service.send_mail('*****@*****.**', '*****@*****.**','Resupply Password Reset', 'html',email)

		return render_template ("user/forgotPassword.html",userNotFound=False,emailSent=True)
Пример #2
0
def requestPasswordChangeSubmit( ):
	user = current_user
	linkRef = str(user.id)[5:10]
	now = datetime.datetime.now().microsecond
	linkRef = linkRef + str(now)
	link = app.config["passwordResetPrefix"] + '?linkRef=' + linkRef;
	password_change_service.createPasswordChangeRequest(user.emailAddress,linkRef)


	email_service.send_mail(user.emailAddress, '*****@*****.**',
		'Resupply Password Link', 'plaintext',
		  'Click the folowing link to reset your password ' + link)


	email_service.send_mail('*****@*****.**', '*****@*****.**',
		'Resupply Password Link', 'plaintext',
		  'Click the folowing link to reset your password ' + link)

	data = {'link':link}
	resp = jsonify(data)
	resp.status_code = 202
	return resp