Ejemplo n.º 1
0
    def get(self, request, *args, **kwargs):
        user = request.user
        key = request.GET.get('k')
        event_type = request.GET.get('type')

        if self.check_and_set_valid_action(user, key):
            # 进入修改页面
            key = self.create_verify_key()
            MailVerificationCode(user=user, code=key, type=2,
                                 expired_time=datetime.now()+CommonEmailData.UPDATE_MAIL_VERIFICATION_CODE_EXPIRED_TIME).save()
            m = {'action_no': key,
                 'type': 'updateEmail',
                 'link': self.create_link(key, 'updateEmail',),
                 'current_mail': mask_mail_url(user.email),
                 }

            # return Response(data=m)
            tpl = 'customer/safety/email/update_mail.html'

            return render(request, tpl, m)
        else:
            # 进入验证错误页面
            m = {'msg': u'链接失效'}

            tpl = 'customer/safety/email/invalid_link.html'

            return render(request, tpl, m)
Ejemplo n.º 2
0
    def get(self, request, *args, **kwargs):
        user = request.user
        key = request.GET.get('r')

        m = {}
        if not user.email or self.__check_and_set_valid_action(user, key):
        # if True:
            # 进入修改页面
            if not user.email:
                tpl = 'customer/safety/email/bind_mail.html'
            else:
                m = {'current_mail': mask_mail_url(request.user.email)}
                tpl = 'customer/safety/email/update_mail.html'
        else:
            # 进入验证页面
            mail = mask_mail_url(request.user.email)
            m = {'current_mail': mail}
            tpl = 'customer/safety/email/update_old_mail.html'

        return render(request, tpl, m)
Ejemplo 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)