new option -noreg for disable new user registration

pull/1/head
vasyahacker 2023-03-31 12:58:44 +04:00
parent 452cc23208
commit 5f17b76832
2 changed files with 4 additions and 1 deletions

View File

@ -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))

View File

@ -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" {