Example #1
0
    def post(self):
        user_id = self.current_user_id
        password = self.get_argument('password', '')
        account = self.get_argument('account', '')
        name = self.get_argument('name', '')
        price = self.get_argument('price', '')

        if user_password_verify(user_id, password):
            a = pay_account_new(user_id, account, name, CID_PAY_ALIPAY)
            try:
                price = float(price)
            except ValueError:
                error = '金额输入错误'
            else:
                price_min = 0.05
                price_max = bank.get(user_id) / 100.

                if price > price_max:
                    error = '提现超出余额'
                elif price < price_min:
                    error = '提现下限为 %s 元' % price_min
                else:
                    t = withdraw_new(price, user_id, CID_PAY_ALIPAY)
                    return self.redirect('/money/drawed/%s' % t.id)
        else:
            error = '密码有误'

        self.render(
            price=price,
            account=account,
            name=name,
            error=error,
        )
Example #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)
Example #3
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)
Example #4
0
    def post(self):
        user_id = self.current_user_id
        password = self.get_argument('password', '')
        account = self.get_argument('account', '')
        name = self.get_argument('name', '')
        price = self.get_argument('price', '')

        if user_password_verify(user_id, password):
            a = pay_account_new(user_id, account, name, CID_PAY_ALIPAY)
            try:
                price = float(price)
            except ValueError:
                error = '金额输入错误'
            else:
                price_min = 0.05
                price_max = bank.get(user_id) / 100.

                if price > price_max:
                    error = '提现超出余额'
                elif price < price_min:
                    error = '提现下限为 %s 元' % price_min
                else:
                    t = withdraw_new(price, user_id, CID_PAY_ALIPAY)
                    return self.redirect('/money/drawed/%s' % t.id)
        else:
            error = '密码有误'

        self.render(
            price=price,
            account=account,
            name=name,
            error=error,
        )
Example #5
0
 def post(self):
     user_id = self.current_user_id
     password0 = self.get_argument('password0', None)
     password = self.get_argument('password', None)
     password2 = self.get_argument('password2', None)
     success = None
     error_password = None
     if all((password0, password, password2)):
         if password == password2:
             if user_password_verify(user_id, password0):
                 user_password_new(user_id, password)
                 success = True
             else:
                 error_password = '******' % escape(
                     mail_by_user_id(user_id))
         else:
             error_password = '******'
     else:
         error_password = '******'
     self.render(success=success, error_password=error_password)
Example #6
0
 def post(self):
     user_id = self.current_user_id
     password0 = self.get_argument("password0", None)
     password = self.get_argument("password", None)
     password2 = self.get_argument("password2", None)
     success = None
     error_password = None
     if all((password0, password, password2)):
         if password == password2:
             if user_password_verify(user_id, password0):
                 user_password_new(user_id, password)
                 success = True
             else:
                 error_password = '******' % escape(
                     mail_by_user_id(user_id)
                 )
         else:
             error_password = "******"
     else:
         error_password = "******"
     self.render(success=success, error_password=error_password)
Example #7
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
Example #8
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