mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +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:
@@ -212,8 +212,10 @@ type defenderHostsPage struct {
|
||||
|
||||
type setupPage struct {
|
||||
basePage
|
||||
Username string
|
||||
Error string
|
||||
Username string
|
||||
HasInstallationCode bool
|
||||
InstallationCodeHint string
|
||||
Error string
|
||||
}
|
||||
|
||||
type folderPage struct {
|
||||
@@ -553,9 +555,11 @@ func renderMaintenancePage(w http.ResponseWriter, r *http.Request, error string)
|
||||
|
||||
func renderAdminSetupPage(w http.ResponseWriter, r *http.Request, username, error string) {
|
||||
data := setupPage{
|
||||
basePage: getBasePageData(pageSetupTitle, webAdminSetupPath, r),
|
||||
Username: username,
|
||||
Error: error,
|
||||
basePage: getBasePageData(pageSetupTitle, webAdminSetupPath, r),
|
||||
Username: username,
|
||||
HasInstallationCode: installationCode != "",
|
||||
InstallationCodeHint: installationCodeHint,
|
||||
Error: error,
|
||||
}
|
||||
|
||||
renderAdminTemplate(w, templateSetup, data)
|
||||
|
||||
Reference in New Issue
Block a user