def get_group(id): if current_user.get_id(): user_grp = get_user(current_user.get_id())[4] user_name = get_user(current_user.get_id())[1] else: user_grp = None user_name = 'Login' return user_name, user_grp
def validate(username, password, database, validType): if not (password and username): return "You need to enter a username and password" if "\'" in (username or password): return "Disallowed character (\" \' \" and \" - \" not allowed)" if "-" in (username or password): return "Disallowed character (\" \' \" and \" - \" not allowed)" conn = create_connection(database) if validType == "signup": if username == get_user(conn, username): return "Username already taken" if validType == "signin": if not (username == get_user(conn, username)) or not ( password == get_user_pwd(conn, username, password)): return "Username or password not correct" return False
def get(userid): try: userdb = get_user(userid) return User(userdb[0], userdb[2]) except: return None