mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
cmd/cli: do not allow running start command if pin code set
While at it, also emitting a better error message when pin code was set but users do not provide --pin flag.
This commit is contained in:
1 parent
583718f234
commit
dabbf2037b
2 files changed
+34
-8
No files matched your search
@@ -160,9 +160,14 @@ func (p *prog) registerControlServerHandler() {
|
||||
mainLog.Load().Err(err).Msg("invalid deactivation request")
|
||||
return
|
||||
}
|
||||
code := http.StatusBadRequest
|
||||
if req.Pin == cdDeactivationPin {
|
||||
|
||||
code := http.StatusForbidden
|
||||
switch req.Pin {
|
||||
case cdDeactivationPin:
|
||||
code = http.StatusOK
|
||||
case defaultDeactivationPin:
|
||||
// If the pin code was set, but users do not provide --pin, return proper code to client.
|
||||
code = http.StatusBadRequest
|
||||
}
|
||||
w.WriteHeader(code)
|
||||
}))
|
||||
|
||||
Reference in new issue
Block a user