Skip to content

Conversation

@RonaldRonnie
Copy link
Contributor

@RonaldRonnie RonaldRonnie commented Jan 24, 2026

What I implemented now

Success/error toasts across admin user flows
Manual user creation (/admin/users/create)

Uses useToast to show:

Success toast: “User created – Temporary credentials have been generated.”
Error toast: “Failed to create user” with server error description.
Validation toast if no role is selected: “Role required”.
Pending registrations (PendingRegistrationsTable)

On approve:

Shows a success toast: “User approved – The user account has been created successfully.”
On error, shows a destructive toast with the backend error.
If role is missing, shows a destructive toast “Role required” and keeps the inline error message.

On reject:

Shows a success toast: “Registration rejected.”
Or destructive toast if the server returns an error.
Pending team members (PendingTeamMembersTable)

On approve:

Shows a success toast: “Team member approved – The user account has been created successfully.”
On error, shows a destructive toast with the backend error.
If role is missing, shows a destructive toast “Role required” and keeps the inline error.
Business rule: prevent removing the last active admin
In ExistingUsersTable for all admin-affecting actions:

Update role:

Before calling updateUserRole, checks how many active admins exist.
If the target user is the only active admin and the new role is not admin, it:

  • Blocks the action.

Shows an inline error message.
Shows a toast: “Cannot change role – You cannot remove the last active admin. Create another admin first.”

  • Disable user:

If trying to disable the only active admin, it:

  • Blocks the action.

Shows a toast “Cannot disable user – You cannot disable the last active admin…”.

  • Delete user:

If trying to delete the only active admin, it:

  • Blocks the action.
  • Shows a toast “Cannot delete user – You cannot delete the last active admin…”.
  • Other users (non-admins, or admins when there are ≥2 active admins) can still be updated/disabled/deleted as before.
  • Toasts on existing user actions
  • Update role: toast “Role updated” on success, “Failed to update role” on error.
  • Disable user: toast “User disabled” / “Failed to disable user”.
  • Enable user: toast “User enabled” / “Failed to enable user”.
  • Delete user: toast “User deleted” / “Failed to delete user”.

Closes: #78

@RonaldRonnie RonaldRonnie merged commit 01a8a78 into main Jan 26, 2026
6 checks passed
@RonaldRonnie RonaldRonnie deleted the user-approval-creation-78 branch January 26, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User Approval and Creation

2 participants