def post(self, request): forget_form = ForgetForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email', '') send_register_email(email, 'forget') return render(request, 'send_success.html') else: return render(request, 'forgetpwd.html', {"forget_form": forget_form})
def post(self, request): forget_form = ForgetForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email', '') send_register_email(email, 'forget') return HttpResponse('<H1>邮件发送成功</H1>') else: return render(request, 'forgetpwd.html', {'forget_form': forget_form})
def post(self, request): forget_form = ForgetForm(request.POST) if forget_form.is_valid(): user_name = request.POST.get("email", "") if UserProfile.objects.filter(email=user_name): send_register_email(user_name, 'forget') return render(request, 'send_success.html') else: return render(request, 'forgetpwd.html', {'forget_form': forget_form})
def post(self, request): forget_form = ForgetForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email', '') send_register_email(email, 'forget') return render(request, 'forgetpwd.html', { 'forget_form': forget_form, 'msg': '重置密码连接已发送,请注意查收!' }) else: return render(request, 'forgetpwd.html', {'forget_form': forget_form})
def post(self, request): forget_form = ForgetForm(request.POST) if forget_form.is_valid(): email = request.POST.get("email", "") if send_email(email, "forget"): return render(request, "send_success.html") else: return render(request, "send_fail.html") else: msg = "邮箱地址不合法!" forget_form._errors["msg"] = forget_form.error_class([msg]) return render(request, "forgetpwd.html", {"forget_form": forget_form})