GSA / notifications-admin

The UI of Notify.gov
https://notify.gov
Other
11 stars 2 forks source link

Added new header button that is displayed in header #2132

Open alexjanousekGSA opened 6 days ago

alexjanousekGSA commented 6 days ago

Added new button in header that allows one to navigate to login from the /about page and other static pages when not logged in. It is currently hidden behind the about feature flag until these pages are fully released.

The new button is only on the /about page and not on the homepage. image

image

alexjanousekGSA commented 4 days ago

Is it expected to get this error when I click on the login button? image

No that is not expected. Are you sure that you have the environment variable in your .env for the login urls? Its using those and maybe if it doesn't exist it wont work?

heyitsmebev commented 4 days ago

@alexjanousekGSA when i click on the button on the homepage, i do not get those errors. Are there additional login env i should consider here?

Are we passing initial_signin_url correctly in inject_initial_signin_url? When I add initial_signin_url directly to about_notify, it works, but I know you're attempting to use it globally here.

This also worked

    @application.context_processor
    def inject_initial_signin_url():
        ttl = 24 * 60 * 60
        # make and store the state
        state = generate_token(
            str(request.remote_addr),
            current_app.config["SECRET_KEY"],
            current_app.config["DANGEROUS_SALT"],
        )
        state_key = f"login-state-{unquote(state)}"
        redis_client.set(state_key, state, ex=ttl)

        # make and store the nonce
        nonce = secrets.token_urlsafe()
        nonce_key = f"login-nonce-{unquote(nonce)}"
        redis_client.set(nonce_key, nonce, ex=ttl)
        url = os.getenv("LOGIN_DOT_GOV_INITIAL_SIGNIN_URL")
        if url is not None:
            url = url.replace("NONCE", nonce)
            url = url.replace("STATE", state)
        return {'initial_signin_url': url}

image