mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 08:44:23 -04:00
Merge branch 'main' of https://github.com/GSA/notifications-admin into 1213-clean-up-usage-content
This commit is contained in:
@@ -160,13 +160,16 @@ def set_up_your_profile():
|
|||||||
# create the user
|
# create the user
|
||||||
# TODO we have to provide something for password until that column goes away
|
# TODO we have to provide something for password until that column goes away
|
||||||
# TODO ideally we would set the user's preferred timezone here as well
|
# TODO ideally we would set the user's preferred timezone here as well
|
||||||
user = User.register(
|
|
||||||
name=form.name.data,
|
user = user_api_client.get_user_by_uuid_or_email(user_uuid, user_email)
|
||||||
email_address=user_email,
|
if user is None:
|
||||||
mobile_number=form.mobile_number.data,
|
user = User.register(
|
||||||
password=str(uuid.uuid4()),
|
name=form.name.data,
|
||||||
auth_type="sms_auth",
|
email_address=user_email,
|
||||||
)
|
mobile_number=form.mobile_number.data,
|
||||||
|
password=str(uuid.uuid4()),
|
||||||
|
auth_type="sms_auth",
|
||||||
|
)
|
||||||
|
|
||||||
# activate the user
|
# activate the user
|
||||||
user = user_api_client.get_user_by_uuid_or_email(user_uuid, user_email)
|
user = user_api_client.get_user_by_uuid_or_email(user_uuid, user_email)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from app.extensions import redis_client
|
|||||||
from app.main import main
|
from app.main import main
|
||||||
from app.main.forms import TwoFactorForm
|
from app.main.forms import TwoFactorForm
|
||||||
from app.models.user import InvitedOrgUser, InvitedUser, User
|
from app.models.user import InvitedOrgUser, InvitedUser, User
|
||||||
|
from app.utils import hilite
|
||||||
from app.utils.login import redirect_to_sign_in
|
from app.utils.login import redirect_to_sign_in
|
||||||
|
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ def activate_user(user_id):
|
|||||||
login_gov_invite_data = redis_client.get(f"service-invite-{user.email_address}")
|
login_gov_invite_data = redis_client.get(f"service-invite-{user.email_address}")
|
||||||
if login_gov_invite_data:
|
if login_gov_invite_data:
|
||||||
login_gov_invite_data = json.loads(login_gov_invite_data.decode("utf8"))
|
login_gov_invite_data = json.loads(login_gov_invite_data.decode("utf8"))
|
||||||
|
current_app.logger.info(hilite(f"LOGIN_GOV_INVITE_DATA {login_gov_invite_data}"))
|
||||||
|
|
||||||
# This is the deprecated path for organization invites where we get id from session
|
# This is the deprecated path for organization invites where we get id from session
|
||||||
session["current_session_id"] = user.current_session_id
|
session["current_session_id"] = user.current_session_id
|
||||||
@@ -85,6 +87,7 @@ def activate_user(user_id):
|
|||||||
return redirect(url_for("main.service_dashboard", service_id=service_id))
|
return redirect(url_for("main.service_dashboard", service_id=service_id))
|
||||||
elif login_gov_invite_data:
|
elif login_gov_invite_data:
|
||||||
service_id = login_gov_invite_data["service_id"]
|
service_id = login_gov_invite_data["service_id"]
|
||||||
|
current_app.logger.info(hilite(f"SERVICE_ID={service_id}"))
|
||||||
|
|
||||||
user.add_to_service(
|
user.add_to_service(
|
||||||
service_id,
|
service_id,
|
||||||
@@ -99,7 +102,10 @@ def activate_user(user_id):
|
|||||||
if invited_org_user:
|
if invited_org_user:
|
||||||
user_api_client.add_user_to_organization(invited_org_user.organization, user_id)
|
user_api_client.add_user_to_organization(invited_org_user.organization, user_id)
|
||||||
elif redis_client.get(f"organization-invite-{user.email_address}"):
|
elif redis_client.get(f"organization-invite-{user.email_address}"):
|
||||||
organization_id = redis_client.get(f"organization-invite-{user.email_address}")
|
organization_id = redis_client.raw_get(
|
||||||
|
f"organization-invite-{user.email_address}"
|
||||||
|
)
|
||||||
|
current_app.logger.info(hilite(f"ORGANIZATION_ID FROM REDIS {organization_id}"))
|
||||||
user_api_client.add_user_to_organization(
|
user_api_client.add_user_to_organization(
|
||||||
organization_id.decode("utf8"), user_id
|
organization_id.decode("utf8"), user_id
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ class UserApiClient(NotifyAdminAPIClient):
|
|||||||
"/user/get-login-gov-user",
|
"/user/get-login-gov-user",
|
||||||
data={"login_uuid": user_uuid, "email": email_address},
|
data={"login_uuid": user_uuid, "email": email_address},
|
||||||
)
|
)
|
||||||
if user_data is None:
|
if user_data is None or user_data.get("data") is None:
|
||||||
raise Exception("User not found")
|
return None
|
||||||
return user_data["data"]
|
return user_data["data"]
|
||||||
|
|
||||||
def get_user_by_email_or_none(self, email_address):
|
def get_user_by_email_or_none(self, email_address):
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ How to integrate with the login.gov sandbox: https://dashboard.int.identitysand
|
|||||||
|
|
||||||
1. Create a team and a user over in the login.gov sandbox.
|
1. Create a team and a user over in the login.gov sandbox.
|
||||||
2. Create a test app:
|
2. Create a test app:
|
||||||
a. you will need to create a unique client id that looks like: urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:test_notify_gov
|
- you will need to create a unique client id that looks like: urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:test_notify_gov
|
||||||
b. Select OpenIdConnect and private key JWT
|
- Select OpenIdConnect and private key JWT
|
||||||
c. select authentication only
|
- select authentication only
|
||||||
d. select MFA required + remember device 30 days only (AAL1)
|
- select MFA required + remember device 30 days only (AAL1)
|
||||||
e. set redirect urls like: http://localhost:6012/sign-in
|
- set redirect urls like: http://localhost:6012/sign-in
|
||||||
3. generate a cert: openssl req -nodes -x509 -days 365 -newkey rsa:2048 -keyout private.pem -out public.crt
|
3. generate a cert: openssl req -nodes -x509 -days 365 -newkey rsa:2048 -keyout private.pem -out public.crt
|
||||||
4. Upload the public.crt to your app in the sandbox
|
4. Upload the public.crt to your app in the sandbox
|
||||||
5. put the private.pem contents and public.crt contents in github secrets (?)
|
5. put the private.pem contents and public.crt contents in github secrets (?)
|
||||||
|
|||||||
Reference in New Issue
Block a user