commit 5f17b7683244d5b5f04cb3222ee62515996af539
parent 452cc23208890a1731370b416c0df3b300960629
Author: vasyahacker <vasya@magicfreedom.com>
Date: Fri, 31 Mar 2023 12:58:44 +0400
new option -noreg for disable new user registration
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/cmd/idecd/main.go b/cmd/idecd/main.go
@@ -61,6 +61,7 @@ var listen_opt *string = flag.String("L", ":8080", "Listen address")
var sysname_opt *string = flag.String("sys", "OpenIDEC", "Node name")
var host_opt *string = flag.String("host", "http://127.0.0.1:8080", "Node address")
var verbose_opt *bool = flag.Bool("v", false, "Verbose")
+var noreg_opt *bool = flag.Bool("noreg", false, "Disable new users registration")
var echo_opt *string = flag.String("e", "list.txt", "Echoes list")
var tpl_path_opt *string = flag.String("tpl", "./tpl", "Path to html templates")
var style_path_opt *string = flag.String("style", "./style", "Path to /style web-directory (css/images)")
@@ -68,6 +69,7 @@ var style_path_opt *string = flag.String("style", "./style", "Path to /style web
type WWW struct {
Host string
tplp string // templates path
+ noreg bool
tpl *template.Template
db *ii.DB
edb *ii.EDB
@@ -136,6 +138,7 @@ func main() {
www.edb = edb
www.udb = udb
www.Host = *host_opt
+ www.noreg= *noreg_opt
WebInit(&www)
fs := http.FileServer(http.Dir(*style_path_opt))
diff --git a/cmd/idecd/web.go b/cmd/idecd/web.go
@@ -967,7 +967,7 @@ func _handleWWW(ctx *WebContext, w http.ResponseWriter, r *http.Request) error {
} else if args[0] == "profile" {
ctx.BasePath = "profile"
return www_profile(ctx, w, r)
- } else if args[0] == "register" {
+ } else if !ctx.www.noreg && args[0] == "register" {
ctx.BasePath = "register"
return www_register(ctx, w, r)
} else if args[0] == "reset" {