aboutsummaryrefslogtreecommitdiff
path: root/api/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/api/user.go b/api/user.go
index f81d4b3f..98c90b48 100644
--- a/api/user.go
+++ b/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