mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-15 00:50:25 +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:
committed by
Cuong Manh Le
parent
583718f234
commit
dabbf2037b
@@ -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