Esempio n. 1
0
    def post(self, request):
        email = request.POST.get('email')

        if UserProfile.objects.filter(email=email):
            user = UserProfile.objects.get(email=email)
            if user.is_active:
                msg = '该用户已经激活!'
            else:
                # 发送邮件
                send_status = send_email_verificode(email, 'active')
                if send_status:
                    msg = '邮件已发送,请注意查收!'
                    context = {
                        'msg': msg,
                    }
                    return render(request,
                                  'users/login/login.html',
                                  context=context)
                else:
                    msg = '邮件发送失败,请检查!'
        else:
            msg = '该邮箱不存在,请检查!'

        context = {
            'msg': msg,
        }
        return render(request, 'users/login/active_user.html', context=context)
Esempio n. 2
0
 def post(self, request):
     email = request.POST.get('email')
     if UserProfile.objects.filter(email=email):
         return HttpResponse('{"status":"falied", "msg":"该邮箱已经被绑定为其它用户!"}',
                             content_type='application/json')
     else:
         send_status = send_email_verificode(email, 'change_email')
         if send_status:
             return HttpResponse(
                 '{"status":"success", "msg":"邮件已发送,请注意查收!"}',
                 content_type='application/json')
         else:
             return HttpResponse('{"status":"failed", "msg":"邮件发送失败,请检查!"}',
                                 content_type='application/json')
Esempio n. 3
0
    def post(self, request):
        user_forget_password_form = UserForgetPasswordForm(request.POST)

        if user_forget_password_form.is_valid():
            email = request.POST.get('email')
            if UserProfile.objects.filter(email=email):
                # 发送邮件
                send_status = send_email_verificode(email, 'forget')
                if send_status:
                    msg = '邮件已发送,请注意查收!'
                else:
                    msg = '邮件发送失败,请检查!'
            else:
                msg = '该邮箱不存在,请检查!'
        else:
            msg = '邮箱格式不合法,请检查!'

        context = {
            'msg': msg,
        }
        return render(request,
                      'users/login/forget_password.html',
                      context=context)