Fixes #61: Added an option to create user on the dashboard's "User" section#64
Fixes #61: Added an option to create user on the dashboard's "User" section#64kabir276 wants to merge 2 commits intostack-auth:devfrom
Conversation
|
@kabir276 is attempting to deploy a commit to the Stackframe Team on Vercel. A member of the Team first needs to authorize it. |
N2D4
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
| type CreateDialogProps = { | ||
| open: boolean; | ||
| onOpenChange: (open: boolean) => void; | ||
| opennotification: Function |
There was a problem hiding this comment.
Instead of passing up a function like this, can you put the notifyPassword dialog into ?
There was a problem hiding this comment.
How about this
setShowNotifyPasswordDialog: React.Dispatch<React.SetStateAction>;
instead of
onOpenChange: (open: boolean) => void;
Will this work?
| const allUsers = stackAdminApp.useServerUsers(); | ||
|
|
||
| const [addUserOpen, setAddUserOpen] = React.useState(false); | ||
| const [notifyPassword, setNotifyPassword] = React.useState(false); |
There was a problem hiding this comment.
| const [notifyPassword, setNotifyPassword] = React.useState(false); | |
| const [showNotifyPasswordDialog, setShowNotifyPasswordDialog] = React.useState(false); |
packages/stack-server/src/app/(main)/(protected)/projects/[projectId]/users/page-client.tsx
Show resolved
Hide resolved
| }); | ||
| } | ||
|
|
||
| async createUser( |
There was a problem hiding this comment.
There is some code duplication between this and signUpWithCredential now. Can we make the latter call this function?
packages/stack/src/lib/stack-app.ts
Outdated
| return errorCode; | ||
| } | ||
|
|
||
| async createUser(options: { |
There was a problem hiding this comment.
There is some code duplication between this and signUpWithCredential now. Can we make the latter call this function?
| if (!errorCode) { | ||
| console.log("done") | ||
| } |
There was a problem hiding this comment.
| if (!errorCode) { | |
| console.log("done") | |
| } |
|
|
||
| const [addUserOpen, setAddUserOpen] = React.useState(false); | ||
| const [notifyPassword, setNotifyPassword] = React.useState(false); | ||
| console.log(notifyPassword) |
There was a problem hiding this comment.
| console.log(notifyPassword) |
packages/stack/src/lib/stack-app.ts
Outdated
|
|
||
| signInWithOAuth(provider: string): Promise<void>, | ||
| signInWithCredential(options: { email: string, password: string }): Promise<KnownErrors["EmailPasswordMismatch"] | undefined>, | ||
| createUser(options: { email: string }): Promise<KnownErrors["UserEmailAlreadyExists"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>, |
There was a problem hiding this comment.
This function should return the generated password.
Do you have any thoughts on whether createUserWithCredential is a better name for this? Since theoretically a user could be a different type as well (OAuth, magic link, etc). Maybe @fomalhautb you have an opinion on this?
Fixes Issue #61
Description
I've added an option to create users on the dashboard's "Users" section. I've created a pull request for your review. Please let me know if this is what you envisioned. If not, I'm happy to make further adjustments.
Changes Made
Updated users>page.client.tsx , lib>stack-app.ts , Interface>clientInterface.ts to include the button to create users.
Additional Notes
No new dependencies were added.