def METHOD_NAME(sender, user, request, **kwargs):
    """
    Take action on user login. Generate a new user access_token to be shared
    with GeoServer, and store it into the request.session
    """
    if user and user.is_authenticated:
        token = None
        try:
            token = get_or_create_token(user)
        except Exception:
            u = uuid1()
            token = u.hex
            tb = traceback.format_exc()
            logger.debug(tb)
        set_session_token(request.session, token)