mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
REST cli: allow to disable password or public_key auth
using something like this: update-user <user-id> <username> --public-keys '' the public keys auth will be disabled using something like this: update-user <user-id> <username> --password '' the password auth will be disabled
This commit is contained in:
@@ -74,6 +74,7 @@ func getUserByID(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func addUser(w http.ResponseWriter, r *http.Request) {
|
||||
var user dataprovider.User
|
||||
user.PublicKeys = []string{}
|
||||
err := render.DecodeJSON(r.Body, &user)
|
||||
if err != nil {
|
||||
sendAPIResponse(w, r, err, "", http.StatusBadRequest)
|
||||
@@ -84,7 +85,6 @@ func addUser(w http.ResponseWriter, r *http.Request) {
|
||||
user, err = dataprovider.UserExists(dataProvider, user.Username)
|
||||
if err == nil {
|
||||
user.Password = ""
|
||||
user.PublicKeys = []string{}
|
||||
render.JSON(w, r, user)
|
||||
} else {
|
||||
sendAPIResponse(w, r, err, "", http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user