mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-10 07:27:52 +08:00
update 2026-08-14 04:36:07
This commit is contained in:
1 parent
e716bb6996
commit
5ce413d3a3
74 files changed
+693
-819
No files matched your search
@@ -1,24 +1,33 @@
|
||||
api = require "luci.passwall2.api"
|
||||
appname = api.appname
|
||||
fs = api.fs
|
||||
|
||||
api.set_default_cbi()
|
||||
|
||||
m = Map("passwall2_server", translate("User Config"))
|
||||
m = Map(api.s_config)
|
||||
m.redirect = api.url("server")
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
if not arg[1] or not m:get(arg[1]) then
|
||||
luci.http.redirect(m.redirect)
|
||||
end
|
||||
|
||||
s = m:section(NamedSection, arg[1], "user", "")
|
||||
s = m:section(NamedSection, arg[1], "user", translate("User Config"))
|
||||
s.addremove = false
|
||||
s.dynamic = false
|
||||
|
||||
o = s:option(Value, "username", translate("Username"))
|
||||
o.datatype = "and(uciname,maxlength(24))"
|
||||
o.rmempty = false
|
||||
function o.validate(self, value, section)
|
||||
local exists = false
|
||||
m:foreach("user", function(s)
|
||||
if s[".name"] ~= section and s.username == value then
|
||||
exists = true
|
||||
return false
|
||||
end
|
||||
end)
|
||||
if exists then
|
||||
return nil, translate("This username already exists.")
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.rmempty = false
|
||||
|
||||
Reference in new issue
Block a user