예제 #1
0
파일: views.py 프로젝트: teliportme/remixvr
def unfollow_user(username):
    user = User.query.filter_by(username=username).first()
    if not user:
        raise InvalidUsage.user_not_found()
    current_user.profile.unfollow(user.profile)
    current_user.profile.save()
    return user.profile
예제 #2
0
def login_user(userid, password, **kwargs):

    # supports logging in with either email or username
    user = None
    if re.match(r"[^@]+@[^@]+\.[^@]+", userid):
        user = User.query.filter_by(email=userid.lower()).first()
    else:
        user = User.query.filter_by(username=userid.lower()).first()
    if user is not None and user.check_password(password):
        user.token = create_access_token(identity=user, fresh=True)
        return user
    else:
        raise InvalidUsage.user_not_found()
예제 #3
0
파일: views.py 프로젝트: teliportme/remixvr
def get_profile(username):
    user = User.query.filter_by(username=username).first()
    if not user:
        raise InvalidUsage.user_not_found()
    return user.profile