示例#1
0
    def post(self):
        errtip = Errtip()
        user_id = self.current_user_id
        user = self.current_user

        password = self.get_argument('password', None)
        mail = self.get_argument('mail', None)
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮件格式不正确'

        if not password:
            errtip.password = '******'
        elif not user_password_verify(user_id, password):
            errtip.password = '******'
            password = ''

        if not errtip:
            from model.user_mail import user_mail_new, user_mail_by_state, MAIL_VERIFIED, user_mail_active_by_user
            if mail in user_mail_by_state(user_id, MAIL_VERIFIED):
                user_mail_active_by_user(user, mail)
                return self.redirect('/i/account/mail/success')

            if user_mail_new(user_id, mail):
                verify_mail_new(user_id, self.current_user.name, mail,
                                CID_VERIFY_LOGIN_MAIL)
            else:
                errtip.mail = '该邮箱已经注册'

        self.render(mail=mail, errtip=errtip, password=password)
示例#2
0
    def post(self):
        errtip = Errtip()
        user_id = self.current_user_id
        user = self.current_user

        password = self.get_argument('password', None)
        mail = self.get_argument('mail', None)
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮件格式不正确'

        if not password:
            errtip.password = '******'
        elif not user_password_verify(user_id, password):
            errtip.password = '******'
            password = ''

        if not errtip:
            from model.user_mail import user_mail_new, user_mail_by_state, MAIL_VERIFIED, user_mail_active_by_user
            if mail in user_mail_by_state(user_id, MAIL_VERIFIED):
                user_mail_active_by_user(user, mail)
                return self.redirect('/i/account/mail/success')

            if user_mail_new(user_id, mail):
                verify_mail_new(
                    user_id, self.current_user.name, mail, CID_VERIFY_LOGIN_MAIL
                )
            else:
                errtip.mail = '该邮箱已经注册'

        self.render(mail=mail, errtip=errtip, password=password)
示例#3
0
def _mail_password_post(self):
    mail = self.get_argument('mail', None)
    password = self.get_argument('password', None)
    errtip = Errtip()

    if mail:
        mail = mail.lower()
    if not mail:
        errtip.mail = '请输入邮箱'
    elif not EMAIL_VALID.match(mail):
        errtip.mail = '邮箱格式有误'

    if not password:
        errtip.password = '******'

    user_id = 0
    if not errtip:
        user_id = user_id_by_mail(mail)
        if user_id:
            if not user_password_verify(user_id, password):
                errtip.password = '******' % escape(mail)

    return user_id , mail, password, errtip
示例#4
0
def _mail_password_post(self):
    mail = self.get_argument('mail', None)
    password = self.get_argument('password', None)
    errtip = Errtip()

    if mail:
        mail = mail.lower()
    if not mail:
        errtip.mail = '请输入邮箱'
    elif not EMAIL_VALID.match(mail):
        errtip.mail = '邮箱格式有误'

    if not password:
        errtip.password = '******'

    user_id = 0
    if not errtip:
        user_id = user_id_by_mail(mail)
        if user_id:
            if not user_password_verify(user_id, password):
                errtip.password = '******' % escape(
                    mail)

    return user_id, mail, password, errtip
示例#5
0
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not (sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

        if name:
            current_user.name = name
            current_user.save()

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
            sex=sex,
            name=name,
            errtip=errtip,
            zsite_list=zsite_list,
        )
示例#6
0
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not(sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

        if name:
            current_user.name = name
            current_user.save()

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
                   sex=sex,
                   name=name,
                   errtip=errtip,
                   zsite_list=zsite_list,
               )