def forgot_password(req): if not req.user.is_anonymous(): return redirect('dashboard') if not req.POST: return render(req, 'forgot_password.html') try: user = User.objects.get(email=req.POST.get('email')) except User.DoesNotExist: user = None if user and user.is_active: send_confirmation_email( user, ugettext('[Pinecast] Password reset'), ugettext(''' We received a request to reset the password for your Pinecast account. If you do not want to reset your password, please ignore this email. '''), reverse('forgot_password_finalize') + '?email=%s' % urlencode(user.email)) return render(req, 'forgot_password_success.html') return render( req, 'forgot_password.html', {'error': ugettext("We don't recognize that email address.")})
def user_settings_page_changeemail(req): if User.objects.filter(email=req.POST.get('new_email')).count(): return redirect(reverse('dashboard') + '?error=eae#settings') send_confirmation_email( req.user, ugettext('[Pinecast] Email change confirmation'), ugettext(''' Someone requested a change to your email address on Pinecast. This email is to verify that you own the email address provided. '''), reverse('user_settings_change_email_finalize') + '?user=%s&email=%s' % (urlencode(str(req.user.id)), urlencode(req.POST.get('new_email'))), req.POST.get('new_email')) return redirect(reverse('dashboard') + '?success=em#settings')
def user_settings_page_changeemail(req): if User.objects.filter(email=req.POST.get('new_email')).count(): return redirect(reverse('user_settings') + '?error=eae') send_confirmation_email( req.user, ugettext('[Pinecast] Email change confirmation'), ugettext(''' Someone requested a change to your email address on Pinecast. This email is to verify that you own the email address provided. '''), reverse('user_settings_change_email_finalize') + '?user=%s&email=%s' % ( urlencode(req.user.id), urlencode(req.POST.get('new_email'))), req.POST.get('new_email') ) return redirect(reverse('user_settings') + '?success=em')
def forgot_password(req): if not req.user.is_anonymous(): return redirect('dashboard') if not req.POST: return render(req, 'forgot_password.html') try: user = User.objects.get(email=req.POST.get('email')) except User.DoesNotExist: user = None if user and user.is_active: send_confirmation_email( user, ugettext('[Pinecast] Password reset'), ugettext(''' We received a request to reset the password for your Pinecast account. If you do not want to reset your password, please ignore this email. '''), reverse('forgot_password_finalize') + '?email=%s' % urlencode(user.email)) return render(req, 'forgot_password_success.html') return render(req, 'forgot_password.html', {'error': ugettext("We don't recognize that email address.")})