Skip to content

Commit

Permalink
update user add email verified flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nic-6443 committed Apr 11, 2022
1 parent ff8a682 commit 533e5e5
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions internal/cli/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ var (
Help: "The user's email.",
IsRequired: true,
}
emailVerified = Flag{
Name: "Email Verified",
LongForm: "email-verified",
Help: "True if the user's email is verified, false otherwise. ",
}
userPassword = Flag{
Name: "Password",
LongForm: "password",
Expand Down Expand Up @@ -350,11 +355,12 @@ auth0 users delete <id>`,

func updateUserCmd(cli *cli) *cobra.Command {
var inputs struct {
ID string
Email string
Password string
Name string
Connection string
ID string
Email string
EmailVerified bool
Password string
Name string
Connection string
}

cmd := &cobra.Command{
Expand Down Expand Up @@ -397,6 +403,10 @@ auth0 users update -n John Doe --email [email protected]`,
return err
}

if err := emailVerified.AskBoolU(cmd, &inputs.EmailVerified, current.EmailVerified); err != nil {
return err
}

if err := userPassword.AskPasswordU(cmd, &inputs.Password, current.Password); err != nil {
return err
}
Expand All @@ -420,6 +430,8 @@ auth0 users update -n John Doe --email [email protected]`,
user.Email = &inputs.Email
}

user.EmailVerified = &inputs.EmailVerified

if len(inputs.Password) == 0 {
user.Password = current.Password
} else {
Expand Down Expand Up @@ -450,6 +462,7 @@ auth0 users update -n John Doe --email [email protected]`,
userConnection.RegisterStringU(cmd, &inputs.Connection, "")
userPassword.RegisterStringU(cmd, &inputs.Password, "")
userEmail.RegisterStringU(cmd, &inputs.Email, "")
emailVerified.RegisterBoolU(cmd, &inputs.EmailVerified, false)

return cmd
}
Expand Down

0 comments on commit 533e5e5

Please sign in to comment.