diff --git a/.ds.baseline b/.ds.baseline index ec87d9c30..82ab59b8d 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -586,20 +586,12 @@ } ], "tests/app/main/views/test_sign_in.py": [ - { - "type": "Private Key", - "filename": "tests/app/main/views/test_sign_in.py", - "hashed_secret": "1348b145fa1a555461c1b790a2f66614781091e9", - "is_verified": false, - "line_number": 31, - "is_secret": false - }, { "type": "Secret Keyword", "filename": "tests/app/main/views/test_sign_in.py", "hashed_secret": "8b8b69116ee882b5e987e330f55db81aba0636f9", "is_verified": false, - "line_number": 104, + "line_number": 90, "is_secret": false } ], @@ -710,5 +702,5 @@ } ] }, - "generated_at": "2024-06-05T22:01:56Z" + "generated_at": "2024-06-11T22:26:18Z" } diff --git a/app/assets/images/logo-login.svg b/app/assets/images/logo-login.svg new file mode 100644 index 000000000..019713377 --- /dev/null +++ b/app/assets/images/logo-login.svg @@ -0,0 +1 @@ + diff --git a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss index d66e276bd..efe86c763 100644 --- a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss +++ b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss @@ -157,6 +157,18 @@ td.table-empty-message { } } +.usa-button img { + margin-left: .5rem; + height: 1rem; +} + +.usa-button.login-button.login-button--primary,.login-button.login-button--primary:hover{ + color:#112e51;background-color:#fff; + border:1px solid #767676; + display: inline-flex; + justify-content: center; +} + .user-list-edit-link:active:before, .user-list-edit-link:focus:before { box-shadow: none; diff --git a/app/main/views/index.py b/app/main/views/index.py index c68605b2e..ec489d5ac 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -1,6 +1,6 @@ import os -from flask import abort, redirect, render_template, request, url_for +from flask import abort, current_app, redirect, render_template, request, url_for from flask_login import current_user from app import status_api_client @@ -9,20 +9,28 @@ from app.main import main from app.main.views.pricing import CURRENT_SMS_RATE from app.main.views.sub_navigation_dictionaries import features_nav, using_notify_nav from app.utils.user import user_is_logged_in - -login_dot_gov_url = os.getenv("LOGIN_DOT_GOV_INITIAL_SIGNIN_URL") +from notifications_utils.url_safe_token import generate_token @main.route("/") def index(): if current_user and current_user.is_authenticated: return redirect(url_for("main.choose_account")) - + token = generate_token( + str(request.remote_addr), + current_app.config["SECRET_KEY"], + current_app.config["DANGEROUS_SALT"], + ) + url = os.getenv("LOGIN_DOT_GOV_INITIAL_SIGNIN_URL") + # handle unit tests + if url is not None: + url = url.replace("NONCE", token) + url = url.replace("STATE", token) return render_template( "views/signedout.html", sms_rate=CURRENT_SMS_RATE, counts=status_api_client.get_count_of_live_services_and_organizations(), - login_dot_gov_url=login_dot_gov_url, + initial_signin_url=url, ) diff --git a/app/templates/views/signedout.html b/app/templates/views/signedout.html index a2aa554f0..fab9fbb30 100644 --- a/app/templates/views/signedout.html +++ b/app/templates/views/signedout.html @@ -21,7 +21,8 @@ Notify.gov

Reach people where they are with government-powered text messages

Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people they serve.

- Sign in + Sign in with Login.gov logo + if you are an existing pilot partner

Currently we are only working with select pilot partners. If you are interested in using Notify.gov in the future, please contact
tts-benefits-studio@gsa.gov to learn more.

diff --git a/app/templates/views/signin.html b/app/templates/views/signin.html index f3b3006d7..c2c6ebe1d 100644 --- a/app/templates/views/signin.html +++ b/app/templates/views/signin.html @@ -32,22 +32,6 @@ Sign in with Login.gov {% endif %} -
-

Effective April 16, 2024 Notify.gov requires you sign-in through Login.gov

-

Why are we doing this?

- -

What do I need to do?

- -
- Create Login.gov account -
- + {% endblock %} diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index 57bdfaa70..1e08cd606 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -19,10 +19,9 @@ def test_non_logged_in_user_can_see_homepage( "Reach people where they are with government-powered text messages" ) - assert page.select_one("a.usa-button.usa-button--big")["href"] == url_for( - "main.sign_in", - ) - + assert page.select_one( + "a.usa-button.login-button.login-button--primary.margin-right-2" + ).text == "Sign in with \n" assert page.select_one("meta[name=description]") is not None # This area is hidden for the pilot # assert normalize_spaces(page.select_one('#whos-using-notify').text) == ( diff --git a/tests/app/main/views/test_sign_in.py b/tests/app/main/views/test_sign_in.py index 135f4a5ba..efa01deb7 100644 --- a/tests/app/main/views/test_sign_in.py +++ b/tests/app/main/views/test_sign_in.py @@ -3,7 +3,6 @@ import uuid import pytest from flask import url_for -from app.main.views.sign_in import _reformat_keystring from app.models.user import User from tests.conftest import SERVICE_ONE_ID, normalize_spaces @@ -20,25 +19,12 @@ def test_render_sign_in_template_for_new_user(client_request): # then these indices need to be 1 instead of 0. # Currently it's not enabled for the test or production environments. assert page.select("main a")[0].text == "Sign in with Login.gov" - assert page.select("main a")[1].text == "Create Login.gov account" # TODO: We'll have to adjust this depending on whether Login.gov is # enabled or not; fix this in the future. assert "Sign in again" not in normalize_spaces(page.text) -def test_reformat_keystring(): - orig = "-----BEGIN PRIVATE KEY----- blah blah blah -----END PRIVATE KEY-----" - expected = """-----BEGIN PRIVATE KEY----- -blah -blah -blah ------END PRIVATE KEY----- -""" - reformatted = _reformat_keystring(orig) - assert reformatted == expected - - def test_sign_in_explains_session_timeout(client_request): client_request.logout() page = client_request.get("main.sign_in", next="/foo") diff --git a/tests/end_to_end/test_landing_and_sign_in_pages.py b/tests/end_to_end/test_landing_and_sign_in_pages.py index a9148cb31..513269f51 100644 --- a/tests/end_to_end/test_landing_and_sign_in_pages.py +++ b/tests/end_to_end/test_landing_and_sign_in_pages.py @@ -22,7 +22,7 @@ def test_landing_page(end_to_end_context): "heading", name="Reach people where they are with government-powered text messages", ) - sign_in_button = page.get_by_role("link", name="Sign in") + sign_in_button = page.get_by_role("link", name="Sign in with") benefits_studio_email = page.get_by_role("link", name="tts-benefits-studio@gsa.gov") # Check to make sure the elements are visible. @@ -31,7 +31,8 @@ def test_landing_page(end_to_end_context): expect(benefits_studio_email).to_be_visible() # Check to make sure the sign-in button and email links are correct. - expect(sign_in_button).to_have_attribute("href", "/sign-in") + href_value = sign_in_button.get_attribute('href') + assert href_value is not None, "The sign-in button does not have an href attribute" expect(benefits_studio_email).to_have_attribute( "href", "mailto:tts-benefits-studio@gsa.gov" )