mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Make user fields editable via API
This commit is contained in:
parent
83f3ccab0e
commit
fd9eaa3e83
7 changed files with 139 additions and 27 deletions
10
api/user.go
10
api/user.go
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
"miniflux.app/http/request"
|
||||
"miniflux.app/http/response/json"
|
||||
"miniflux.app/model"
|
||||
)
|
||||
|
||||
func (h *handler) currentUser(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -28,12 +29,19 @@ func (h *handler) createUser(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
user, err := decodeUserCreationRequest(r.Body)
|
||||
userCreationRequest, err := decodeUserCreationRequest(r.Body)
|
||||
if err != nil {
|
||||
json.BadRequest(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
user := model.NewUser()
|
||||
user.Username = userCreationRequest.Username
|
||||
user.Password = userCreationRequest.Password
|
||||
user.IsAdmin = userCreationRequest.IsAdmin
|
||||
user.GoogleID = userCreationRequest.GoogleID
|
||||
user.OpenIDConnectID = userCreationRequest.OpenIDConnectID
|
||||
|
||||
if err := user.ValidateUserCreation(); err != nil {
|
||||
json.BadRequest(w, r, err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue