Skip to content

Commit

Permalink
user successfully created
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-labri-tipton committed Oct 10, 2023
1 parent 8f85d32 commit 153cfc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ def create_user(
:param site_group: name of site group
"""

if site_group is None:
site_group = "ocf"

user = UserSQL(
email=email,
Expand All @@ -294,4 +296,4 @@ def create_user(
session.add(user)
session.commit()

return user, message
return user
8 changes: 5 additions & 3 deletions src/sites_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,16 @@ def sites_toolbox_page():
)

email = st.text_input("email")

if email is not None:
if not re.match(r"[^@]+@[^@]+\.[^@]+", email):
st.write("Please enter a valid email address.")
site_group = st.selectbox("Select a group", site_groups, key="site_group")
# check that site group exists
if st.button(f"Create new user"):
site_group = get_site_group_by_name(
session=session, site_group_name=site_group
)
user, message = create_user(
user = create_user(
session=session,
email=email,
site_group=site_group,
Expand All @@ -429,5 +431,5 @@ def sites_toolbox_page():
"date_added": (user.created_utc.strftime("%Y-%m-%d")),
}
st.json(user_details)
if st.button("Close site details"):
if st.button("Close user details"):
st.empty()

0 comments on commit 153cfc3

Please sign in to comment.