Example #1
0
def create_user(http_request, email, password, nickname):
    userService = UserService()
    userService.createUser(email, password, nickname)
    user = authenticate(username=email, password=password)
    login(http_request, user)
    userService.save_ip(http_request)
    return userService.to_dto(user)
Example #2
0
def login_user(http_request, username, password):
    user = authenticate(username=username, password=password)
    userService = UserService()
    if user is not None:
        login(http_request, user)
        userService.save_ip(http_request)
        return userService.to_dto(user)
    return None
Example #3
0
def get_user(http_request):
    userService = UserService()
    if http_request.user.is_authenticated():
        return userService.to_dto(http_request.user)
    return None