Esempio n. 1
0
    def get(self, request, *args, **kwargs):
        user = request.user

        if False: #not hasattr(user, 'userprofile') or not user.userprofile.mobile_phone:
            # 当前没有绑定手机,进入绑定页面
            tpl = 'customer/safety/mobile/bind_mobile.html'
            # m = {"current_mobile": '12345678901'}
            return render(request, tpl)
        else:
            # 进入修改页面
            tpl = 'customer/safety/mobile/update_mobile.html'
            # m = {"current_mobile": mask_mobile(user.userprofile.mobile_phone)}
            m = {"current_mobile": mask_mobile(user.userprofile.mobile_phone)}
            return render(request, tpl, m)
Esempio n. 2
0
    def get(self, request, *args, **kwargs):
        user = request.user
        vcode = request.GET.get('vcode')

        flag =1 #TODO
        # flag = SmsVerificationCode.objects.filter(user=user, code=vcode,
        #                                  status=0, type=1, expired_time__gte=datetime.now()).update(status=1)
        if flag>0:
            # 当前没有绑定手机,进入绑定页面
            tpl = 'customer/safety/mobile/bind_mobile.html'
            # m = {"current_mobile": '12345678901'}
            return render(request, tpl)
        else:
            tpl = 'customer/safety/mobile/update_mobile.html'
            m = {"current_mobile": mask_mobile(user.userprofile.mobile_phone),
                 'msg': u'验证码无效',
                 'is_invalid_vcode':  True,
                 'vcode_err_msg': u'验证码无效',
                 }
            return render(request, tpl, m)
Esempio n. 3
0
    def get(self, request, *args, **kwargs):
        user = request.user

        rank = 1
        if user.email:
            email = mask_mail_url(user.email)
            rank += 1
        else:
            email = ''
        mobile = ''
        has_pay_pwd = False
        has_delivery_pwd = False
        if hasattr(user, 'userprofile'):
            if user.userprofile.mobile_phone:
                rank += 1
                mobile = mask_mobile(user.userprofile.mobile_phone)
            if user.userprofile.pay_pwd:
                has_pay_pwd = True
            if user.userprofile.pickup_pwd:
                has_delivery_pwd = True

        if has_pay_pwd:
            rank += 1
        if has_delivery_pwd:
            rank += 1

        payment_pwd = {'exist': has_pay_pwd,
                       # 'safe_rank': 3, 'tip': '建议设置更高强度密码',
                       }
        delivery_pwd = {'exist': has_delivery_pwd,
                       # 'safe_rank': 3, 'tip': '建议设置更高强度密码',
                       }
        safe_rank = {'rank': rank,
                     # 'text': '低',
                     # 'tip': '建议您启动全部安全设置,以保障账户及资金安全。'
                     }
        m = {'safe_rank': safe_rank, 'email': email, 'mobile': mobile, 'payment_pwd': payment_pwd, 'delivery_pwd': delivery_pwd}
        m['frame_id'] = 'safety'

        tpl = 'customer/safety/account_safety.html'
        return render(request, tpl, m)
Esempio n. 4
0
    def post(self, request, *args, **kwargs):
        user = request.user
        vcode = request.data.get('vcode')

        flag = SmsVerificationCode.objects.filter(user=user, code=vcode,
                                         status=0, type=1, expired_time__gte=datetime.now()).exists()
        if flag:
            # 进入绑定页面
            tpl = 'customer/safety/mobile/bind_mobile.html'
            # m = {"current_mobile": '12345678901'}
            s = reverse('customer:safety-validate-mobile-bind_mobile')
            s += '?vcode='+vcode
            return HttpResponseRedirect(s)
            # return redirect('customer:safety-validate-mobile-bind_mobile', vcode=vcode)
        else:
            tpl = 'customer/safety/mobile/update_mobile.html'
            m = {"current_mobile": mask_mobile(user.userprofile.mobile_phone),
                 'msg': u'验证码无效',
                 'is_invalid_vcode':  True,
                 'vcode_err_msg': '验证码无效',
                 }
            return render(request, tpl, m)