Skip to content

Commit 13e4b22

Browse files
committed
change to ownpassword
1 parent c7f2a67 commit 13e4b22

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

coderd/coderd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,19 @@ func New(options *Options) *API {
239239
=======
240240
r.Get("/", a.userByName)
241241
r.Put("/profile", a.putUserProfile)
242+
<<<<<<< HEAD
242243
r.Put("/security", a.putUserSecurity)
243244
>>>>>>> fix: Add route for user to change own password
245+
=======
246+
>>>>>>> change to ownpassword
244247
r.Route("/status", func(r chi.Router) {
245248
r.Put("/suspend", api.putUserStatus(database.UserStatusSuspended))
246249
r.Put("/active", api.putUserStatus(database.UserStatusActive))
247250
})
248251
r.Route("/password", func(r chi.Router) {
249252
r.Put("/", api.putUserPassword)
250253
})
254+
r.Put("/ownpassword", a.putUserOwnPassword)
251255
// These roles apply to the site wide permissions.
252256
r.Put("/roles", api.putUserRoles)
253257
r.Get("/roles", api.userRoles)

coderd/users.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ func (api *API) putUserProfile(rw http.ResponseWriter, r *http.Request) {
311311
httpapi.Write(rw, http.StatusOK, convertUser(updatedUserProfile, organizationIDs))
312312
}
313313

314+
<<<<<<< HEAD
314315
func (api *API) putUserSecurity(rw http.ResponseWriter, r *http.Request) {
316+
=======
317+
func (api *api) putUserOwnPassword(rw http.ResponseWriter, r *http.Request) {
318+
>>>>>>> change to ownpassword
315319
user := httpmw.UserParam(r)
316320

317321
// this route is for the owning user so we need to check the old password
@@ -320,7 +324,7 @@ func (api *API) putUserSecurity(rw http.ResponseWriter, r *http.Request) {
320324
return
321325
}
322326

323-
var params codersdk.UpdateUserSecurityRequest
327+
var params codersdk.UpdateUserOwnPasswordRequest
324328
if !httpapi.Read(rw, r, &params) {
325329
return
326330
}

codersdk/users.go

Lines changed: 1 addition & 1 deletion
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)