Skip to content

Commit 8ed6960

Browse files
committed
change to ownpassword
1 parent 881a2bd commit 8ed6960

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

coderd/coderd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ func newRouter(options *Options, a *api) chi.Router {
236236
r.Use(httpmw.ExtractUserParam(options.Database))
237237
r.Get("/", a.userByName)
238238
r.Put("/profile", a.putUserProfile)
239-
r.Put("/security", a.putUserSecurity)
240239
r.Route("/status", func(r chi.Router) {
241240
r.Put("/suspend", a.putUserStatus(database.UserStatusSuspended))
242241
r.Put("/active", a.putUserStatus(database.UserStatusActive))
243242
})
244243
r.Route("/password", func(r chi.Router) {
245244
r.Put("/", a.putUserPassword)
246245
})
246+
r.Put("/ownpassword", a.putUserOwnPassword)
247247
// These roles apply to the site wide permissions.
248248
r.Put("/roles", a.putUserRoles)
249249
r.Get("/roles", a.userRoles)

coderd/users.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func (api *api) putUserProfile(rw http.ResponseWriter, r *http.Request) {
311311
httpapi.Write(rw, http.StatusOK, convertUser(updatedUserProfile, organizationIDs))
312312
}
313313

314-
func (api *api) putUserSecurity(rw http.ResponseWriter, r *http.Request) {
314+
func (api *api) putUserOwnPassword(rw http.ResponseWriter, r *http.Request) {
315315
user := httpmw.UserParam(r)
316316

317317
// this route is for the owning user so we need to check the old password
@@ -320,7 +320,7 @@ func (api *api) putUserSecurity(rw http.ResponseWriter, r *http.Request) {
320320
return
321321
}
322322

323-
var params codersdk.UpdateUserSecurityRequest
323+
var params codersdk.UpdateUserOwnPasswordRequest
324324
if !httpapi.Read(rw, r, &params) {
325325
return
326326
}

codersdk/users.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type UpdateUserPasswordRequest struct {
6868
Password string `json:"password" validate:"required"`
6969
}
7070

71-
type UpdateUserSecurityRequest struct {
71+
type UpdateUserOwnPasswordRequest struct {
7272
OldPassword string `json:"old_password" validate:"required"`
7373
Password string `json:"password" validate:"required"`
7474
}

0 commit comments

Comments
 (0)