@@ -99,7 +99,7 @@ func (c *DefaultClient) UserByEmail(ctx context.Context, email string) (*User, e
99
99
// UpdateUserReq defines a modification to the user, updating the
100
100
// value of all non-nil values.
101
101
type UpdateUserReq struct {
102
- // TODO(@cmoog) add update password option
102
+ * UserPasswordSettings
103
103
Revoked * bool `json:"revoked,omitempty"`
104
104
Roles * []Role `json:"roles,omitempty"`
105
105
LoginType * LoginType `json:"login_type,omitempty"`
@@ -109,6 +109,27 @@ type UpdateUserReq struct {
109
109
DotfilesGitURL * string `json:"dotfiles_git_uri,omitempty"`
110
110
}
111
111
112
+ // UserPasswordSettings allows modification of the user's password
113
+ // settings.
114
+ //
115
+ // These settings are only applicable to users managed using the
116
+ // built-in authentication provider; users authenticating using
117
+ // OAuth must change their password through the identity provider
118
+ // instead.
119
+ type UserPasswordSettings struct {
120
+ // OldPassword is the account's current password.
121
+ OldPassword string `json:"old_password,omitempty"`
122
+
123
+ // Password is the new password, which may be a temporary password.
124
+ Password string `json:"password,omitempty"`
125
+
126
+ // Temporary indicates that API access should be restricted to the
127
+ // password change API and a few other APIs. If set to true, Coder
128
+ // will prompt the user to change their password upon their next
129
+ // login through the web interface.
130
+ Temporary bool `json:"temporary_password,omitempty"`
131
+ }
132
+
112
133
// UpdateUser applyes the partial update to the given user.
113
134
func (c * DefaultClient ) UpdateUser (ctx context.Context , userID string , req UpdateUserReq ) error {
114
135
return c .requestBody (ctx , http .MethodPatch , "/api/v0/users/" + userID , req , nil )
0 commit comments