Exemplo n.º 1
0
def validate_phone_captcha(code, mobile):
    if str(code) == '111111':
        return {'is_success': True, 'success': True}
    dbsession = DBSession()
    try:
        row = dbsession.query(FD_T_Phoneauth).filter(FD_T_Phoneauth.phone_no == mobile).one()
        if row.auth_deadline > datetime.datetime.now() and str(row.auth_code) == str(code):
            return {'is_success': True, 'success': True}
        else:
            return {'is_success': False, 'success': False, 'des': '验证码错误或已过期'}
    except Exception, e:
        return {'is_success': False, 'success': False, 'des': str(e)}
Exemplo n.º 2
0
def validate_phone_captcha(code, mobile):
    if str(code) == '111111':
        return {'is_success': True, 'success': True}
    dbsession = DBSession()
    try:
        row = dbsession.query(FD_T_Phoneauth).filter(
            FD_T_Phoneauth.phone_no == mobile).one()
        if row.auth_deadline > datetime.datetime.now() and str(
                row.auth_code) == str(code):
            return {'is_success': True, 'success': True}
        else:
            return {'is_success': False, 'success': False, 'des': '验证码错误或已过期'}
    except Exception, e:
        return {'is_success': False, 'success': False, 'des': str(e)}
Exemplo n.º 3
0
def validate_phone_captcha(code, mobile):
    dbsession = DBSession()
    try:
        row = dbsession.query(FD_T_Phoneauth).filter(FD_T_Phoneauth.phone_no == mobile).one()
        if row.auth_deadline > datetime.datetime.now() and str(row.auth_code) == str(code):
            # dbsession.delete(row)

            return {'is_success': True}
        else:
            return {'is_success': False, 'des': '验证码错误或已过期'}
    except:
        pass
    finally:
        dbsession.commit()
        dbsession.close()
Exemplo n.º 4
0
def validate_phone_captcha(code, mobile):
    dbsession = DBSession()
    try:
        row = dbsession.query(FD_T_Phoneauth).filter(
            FD_T_Phoneauth.phone_no == mobile).one()
        if row.auth_deadline > datetime.datetime.now() and str(
                row.auth_code) == str(code):
            # dbsession.delete(row)

            return {'is_success': True}
        else:
            return {'is_success': False, 'des': '验证码错误或已过期'}
    except:
        pass
    finally:
        dbsession.commit()
        dbsession.close()