Example #1
0
def register(username,password,email):
    '''验证用户是否存在 ,不存在就添加到数据库'''
    if User.is_exists(username):
        return {'msg':'username already exits'}

    hash_pass = hash_it(password)
    User.add_user(username,hash_pass,email)
    return {'msg':'ok'}
Example #2
0
def register(username, password, email):
    """
    把用户注册信息添加进数据库
    """
    if User.is_exists(username):
        return {'msg': 'username is exists'}

    hash_pass = hash_it(password)
    User.add_user(username, password=hash_pass, email=email)
    return {'msg': 'ok'}
Example #3
0
def register(username, password):
    """
    注册用户,增加用户信息到数据库
    :param username:
    :param password:
    :return:
    """
    if not User.is_exists(username):
        User.add_user(username, hashed(password))
        return {'msg': 'ok'}
    else:
        return {'msg': '用户名已存在,请重新注册. '}
Example #4
0
 def register(self, password):
     """
     用户注册
     :param password:
     :return:
     """
     if not User.user_is_exists(username=self.username, session=self.db):
         User.add_user(username=self.username,
                       password=hashed(password),
                       session=self.db)
         return {'msg': 'ok'}
     else:
         return {'msg': '此用户已经存在'}
Example #5
0
def register(name, password, email):
    '''
    注册
    :param name: 用户名
    :param password: 密码
    :param email: 邮箱
    :return: ok/user is exists
    '''
    if User.exists_it(name):
        return 'user is exists'

    pw = hash_it(password)
    print(name, pw, password)
    User.add_user(name, pw, email)
    return 'ok'
Example #6
0
def register(db_session, username, password):
    """
    用于处理注册逻辑,将用户信息保存到数据库
    :param username:
    :param password:
    :return:
    """
    if User.is_exist(db_session, username):
        return 'user is existed'
    else:
        return User.add_user(db_session, username, hashed(password))
Example #7
0
def register(username, password):
    if User.is_exists(username):
        return '已存在用户名'
    else:
        User.add_user(username, hashMD5(password))
        return 'ok'
Example #8
0
def register(username, password):
    if User.is_exists(username):
        return {'msg': 'username is exists'}
    hash_pass = hashed(password)
    User.add_user(username, hash_pass)
    return {'msg': 'ok'}
Example #9
0
def register(username, password, email):
    if User.is_exists(username):
        return {'msg': 'username exists'}
    hash_pass = hash_it(password)
    User.add_user(username, hash_pass, email)
    return {'msg': 'OK'}