forked from auth0/auth0-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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{ | ||
|
@@ -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 | ||
} | ||
|
@@ -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 { | ||
|
@@ -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 | ||
} | ||
|