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)
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
def get_user(http_request): userService = UserService() if http_request.user.is_authenticated(): return userService.to_dto(http_request.user) return None