def post(self,request): forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email',None) send_register_eamil(email,'forget') return render(request, 'send_success.html') else: return render(request,'forgetpwd.html',{'forget_form':forget_form})
def post(self, request): forget_form = ForgetPwdForm(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")
def post(request): forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email') send_status = send_register_email(email, 'forget') if send_status: return render(request, 'send_success.html') return HttpResponse('发送失败') return render(request, 'forgetpwd.html', {'forget_form': forget_form})
def post(self, request): # 对邮箱地址一个验证 forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): email = request.POST['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 = ForgetPwdForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email') status = send_register_email(email, 'forget') if status: return HttpResponse(u'邮件发送成功, 请查收') else: return render(request, 'forgetpwd.html', {'msg': '重置失败请重新输入!'}) else: return render(request, 'forgetpwd.html', {'forget_form': forget_form})
def post(self, request): forget_pwd_form = ForgetPwdForm(request.POST) if forget_pwd_form.is_valid(): email = request.POST.get('email','') if UserProfile.objects.filter(email=email): send_register_email(email,send_type=1) return render(request,'send_success.html') else: return render(request,'forgetpwd.html',{'msg':'用户名不存在','forget_pwd_form':forget_pwd_form}) else: return render(request,'forgetpwd.html',{'forget_pwd_form':forget_pwd_form})
def post(self, request): forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): # 验证email是否有效 email = request.POST.get('email', '') if UserProfile.objects.get(email=email): # 判断用户是否存在,然后发邮件 send_register_email(email, "forget") return HttpResponse("重置密码链接已发送到您的邮箱,请查收后点击重置.") else: return render(request, 'forget_pwd.html', { 'msg': '用户不存在', 'forget_form': forget_form })
def post(self, request): forgetpwd_form = ForgetPwdForm(request.POST) if forgetpwd_form.is_valid(): email = request.POST.get("email", "") send_register_email(email, "forget") return render(request, "send_success.html", {"email": email}) else: print(u"验证码错误") return render(request, 'register.html', { "forget_form": forgetpwd_form, "msg": "验证码错误" })
def post(self, request): email = request.POST.get('email') forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): if UserInfo.objects.filter(email=email): send_register_email(email, 'forget') return render(request, 'send_success.html', locals()) else: forget_message = '用户不存在.' return render(request, 'forgetpwd.html', locals()) else: return render(request, 'forgetpwd.html', locals())
def post(self, request): forgetpwd_form = ForgetPwdForm(request.POST) if forgetpwd_form.is_valid(): user_name = request.POST.get('email', '') user = UserProfile.objects.filter(email=user_name) if not user: return render(request, 'forgetpwd.html', {'msg': '用户不存在'}) send_email_code(user_name, 'forget') return render(request, 'send_success.html') else: return render(request, 'forgetpwd.html', {'forgetpwd_form': forgetpwd_form})
def post(self, request): forget_from = ForgetPwdForm(request.POST) if forget_from.is_valid(): email = request.POST.get("email", "") # 与数据库做对比 if UserInfo.objects.filter(email=email): send_register_email(email, 'forget') return render(request, 'send_success.html', {'email': email}) return render(request, 'forgetpwd.html', {'msg': u"用户不存在!!", 'forget_from': forget_from}) else: return render(request, 'forgetpwd.html', {'forget_from': forget_from})
def post(self, request): if request.user.is_authenticated: messages.add_message(request, messages.INFO, '用户已登录,请登出后再访问') return redirect(reverse('index')) forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email', None) send_register_email(email, 'forget') messages.add_message(request, messages.SUCCESS, '邮件已发送,请查收') return redirect(reverse('login')) else: messages.add_message(request, messages.ERROR, '表单验证失败,请重新提交表单', extra_tags="danger") return render(request, 'forgetpwd.html', {'forget_form': forget_form})
def get(self, request): banner_courses = Course.objects.filter(is_banner=True)[:3] forget_pwd_form = ForgetPwdForm() return render(request, 'forgetpwd.html', { 'forget_pwd_form': forget_pwd_form, 'banner_courses': banner_courses })
def post(self, request): if request.user.is_authenticated: messages.add_message(request, messages.INFO, '用户已登录,请登出后再访问') return redirect(reverse('index')) forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid(): email = request.POST.get('email', None) user = UserProfile.objects.get(email=email) if user.is_active: messages.add_message(request, messages.WARNING, '用户已激活,请勿重复激活', extra_tags="warning") return redirect(reverse('login')) send_register_email(email, 'reactive') messages.add_message(request, messages.SUCCESS, '邮件已发送,请查收') return redirect(reverse('login')) else: messages.add_message(request, messages.ERROR, '表单验证失败,请重新提交表单', extra_tags="danger") return render(request, 'reactive.html', {'forget_form': forget_form})
def post(self, request): forms = ForgetPwdForm(request.POST) if forms.is_valid(): email = request.POST.get('email', '') all_records = UserProfile.objects.filter(email=email) if all_records: send_register_email(email, 'forget') return render(request, 'send_success.html') else: register_form = RegisterForm() return render(request, 'register.html', { 'register_form': register_form, 'msg': '该用户不存在请注册' }) else: register_form = RegisterForm() return render(request, 'forgetpwd.html', { 'register_form': register_form, 'msg': '请输入正确邮箱' })
def post(self, request): """表单提交的方法""" forget_form = ForgetPwdForm(request.POST) if forget_form.is_valid: email = request.POST.get("email", "") send_register_eamil(email, "forget") return render(request, "send_success.html") else: return render(request, "forgetpwd.html", {"forget_form": forget_form}) pass
def post(self, request): forget_pwd_form = ForgetPwdForm(request.POST) if forget_pwd_form.is_valid(): user_id = request.POST.get("user_id", "") if validate_mobile(user_id): # send a new mail for reset password 测试成功 # send_register_mobile(user_id, "forget", ) pass return redirect('users:login') else: # send a new mail for reset password 测试成功 send_register_email( user_id, "forget", ) # 提示已经发了邮件 return render(request, "send_resetPwd_success.html") else: return render(request, "forgot_password.html", {"forgetPwd_form": forget_pwd_form})
def post(self, request): forget_pwd_form = ForgetPwdForm(request.POST) banner_courses = Course.objects.filter(is_banner=True)[:3] if forget_pwd_form.is_valid(): email = request.POST.get('email') user = UserProfile.objects.filter(email=email) #检查账户是否存在,不存在则不发送邮箱 if user: send_email(email, 'forget') return render(request, 'send_success.html') else: return render( request, 'forgetpwd.html', { 'forget_pwd_form': forget_pwd_form, 'banner_courses': banner_courses, 'msg': '账户不存在!' }) else: return render( request, 'forgetpwd.html', { 'forget_pwd_form': forget_pwd_form, 'banner_courses': banner_courses })
def get(self, request): # 这一步是为什么??????? forget_form = ForgetPwdForm() return render(request, "forgetpwd.html", {"forget_form": forget_form}) pass
def get(self, request): forgetpwd_form = ForgetPwdForm() return render(request, "forgetpwd.html", {"forgetpwd_form": forgetpwd_form})
def get(self, request): forms = ForgetPwdForm() return render(request, 'forgetpwd.html', {'forms': forms})
def get(self, request): forget_pwd_form = ForgetPwdForm() return render(request,'forgetpwd.html',{'forget_pwd_form':forget_pwd_form})
def get(self, request): forget_form = ForgetPwdForm() return render(request, 'forgetpwd.html', locals())
def get(self, request): if request.user.is_authenticated: messages.add_message(request, messages.INFO, '用户已登录,请登出后再访问') return redirect(reverse('index')) forget_form = ForgetPwdForm() return render(request, 'reactive.html', {'forget_form': forget_form, 'title': "忘记密码"})