Add first-login password setup flow
Accounts created by tenant/store onboarding (createtenantuser, createtenantlocation) have no password set. Previously the login form treated the backend's "please setup a password" response as a successful login instead of prompting for one. Now auth.ts recognizes it (PasswordSetupRequiredError) and LoginView routes to a create- password step, then signs in immediately with the new password. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,7 @@ import {
|
||||
getUserById,
|
||||
createUser,
|
||||
updateUser,
|
||||
setUserPassword,
|
||||
assignRiderToOrders,
|
||||
CreateUserInput,
|
||||
createTenantUser,
|
||||
@@ -892,6 +893,18 @@ export function useLogin() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set (or reset) a user's login password — used by the login flow's
|
||||
* create-password step (see PasswordSetupRequiredError in ./auth) for a
|
||||
* first-time tenant admin or store login.
|
||||
*/
|
||||
export function useSetPassword() {
|
||||
return useMutation({
|
||||
mutationFn: (input: { userid: number; password: string }) =>
|
||||
setUserPassword(input.userid, input.password),
|
||||
});
|
||||
}
|
||||
|
||||
export function useFiestaDeleteLocation() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
|
||||
Reference in New Issue
Block a user