Add files via upload
This commit is contained in:
parent
8d87e0d5f9
commit
11b47e6898
@ -118,6 +118,7 @@ var loginHandler = func(w http.ResponseWriter, r *http.Request, d *data) (int, e
|
|||||||
type signupBody struct {
|
type signupBody struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
|
InvitationCode string `json:"invitationCode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var signupHandler = func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
var signupHandler = func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
||||||
@ -139,6 +140,12 @@ var signupHandler = func(w http.ResponseWriter, r *http.Request, d *data) (int,
|
|||||||
return http.StatusBadRequest, nil
|
return http.StatusBadRequest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if d.UseInvitationCode {
|
||||||
|
if d.InvitationCode!=info.InvitationCode{
|
||||||
|
return http.StatusUnauthorized, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
user := &users.User{
|
user := &users.User{
|
||||||
Username: info.Username,
|
Username: info.Username,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,24 +9,28 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type settingsData struct {
|
type settingsData struct {
|
||||||
Signup bool `json:"signup"`
|
Signup bool `json:"signup"`
|
||||||
CreateUserDir bool `json:"createUserDir"`
|
CreateUserDir bool `json:"createUserDir"`
|
||||||
Defaults settings.UserDefaults `json:"defaults"`
|
UseInvitationCode bool `json:"useInvitationCode"`
|
||||||
Rules []rules.Rule `json:"rules"`
|
InvitationCode string `json:"invitationCode"`
|
||||||
Branding settings.Branding `json:"branding"`
|
Defaults settings.UserDefaults `json:"defaults"`
|
||||||
Shell []string `json:"shell"`
|
Rules []rules.Rule `json:"rules"`
|
||||||
Commands map[string][]string `json:"commands"`
|
Branding settings.Branding `json:"branding"`
|
||||||
|
Shell []string `json:"shell"`
|
||||||
|
Commands map[string][]string `json:"commands"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var settingsGetHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
var settingsGetHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
|
||||||
data := &settingsData{
|
data := &settingsData{
|
||||||
Signup: d.settings.Signup,
|
Signup: d.settings.Signup,
|
||||||
CreateUserDir: d.settings.CreateUserDir,
|
CreateUserDir: d.settings.CreateUserDir,
|
||||||
Defaults: d.settings.Defaults,
|
UseInvitationCode: d.settings.UseInvitationCode,
|
||||||
Rules: d.settings.Rules,
|
InvitationCode: d.settings.InvitationCode,
|
||||||
Branding: d.settings.Branding,
|
Defaults: d.settings.Defaults,
|
||||||
Shell: d.settings.Shell,
|
Rules: d.settings.Rules,
|
||||||
Commands: d.settings.Commands,
|
Branding: d.settings.Branding,
|
||||||
|
Shell: d.settings.Shell,
|
||||||
|
Commands: d.settings.Commands,
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderJSON(w, r, data)
|
return renderJSON(w, r, data)
|
||||||
@ -41,6 +45,8 @@ var settingsPutHandler = withAdmin(func(w http.ResponseWriter, r *http.Request,
|
|||||||
|
|
||||||
d.settings.Signup = req.Signup
|
d.settings.Signup = req.Signup
|
||||||
d.settings.CreateUserDir = req.CreateUserDir
|
d.settings.CreateUserDir = req.CreateUserDir
|
||||||
|
d.settings.UseInvitationCode = req.UseInvitationCode
|
||||||
|
d.settings.InvitationCode = req.InvitationCode
|
||||||
d.settings.Defaults = req.Defaults
|
d.settings.Defaults = req.Defaults
|
||||||
d.settings.Rules = req.Rules
|
d.settings.Rules = req.Rules
|
||||||
d.settings.Branding = req.Branding
|
d.settings.Branding = req.Branding
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user