mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
web setup: add an optional installation code
The purpose of this code is to prevent anyone who can access to the initial setup screen from creating an admin user Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -603,6 +603,11 @@ func (s *httpdServer) handleWebAdminSetupPost(w http.ResponseWriter, r *http.Req
|
||||
}
|
||||
username := r.Form.Get("username")
|
||||
password := r.Form.Get("password")
|
||||
installCode := r.Form.Get("install_code")
|
||||
if installationCode != "" && installCode != installationCode {
|
||||
renderAdminSetupPage(w, r, username, fmt.Sprintf("%v mismatch", installationCodeHint))
|
||||
return
|
||||
}
|
||||
confirmPassword := r.Form.Get("confirm_password")
|
||||
if username == "" {
|
||||
renderAdminSetupPage(w, r, username, "Please set a username")
|
||||
|
||||
Reference in New Issue
Block a user