<% local msg = {} if _SESSION["logined"] ~= nil then local domain = _POST["domain"] local user = _POST["user"] local oldname = _POST["oldname"] local resetstat = _POST["resetstat"] or nil if user ~= nil then user = json.decode(user) user.note_name = specialhtml_encode_enhance(user.note_name) user.note_address = specialhtml_encode_enhance(user.note_address) user.note_zip = specialhtml_encode_enhance(user.note_zip) user.note_phone = specialhtml_encode_enhance(user.note_phone) user.note_fax = specialhtml_encode_enhance(user.note_fax) user.note_email = specialhtml_encode_enhance(user.note_email) user.note_memo = specialhtml_encode_enhance(user.note_memo) if oldname ~= user.username then local result, bADuser = c_UserExist(domain,user.username) if result == true then if bADuser == true then rawset(msg, "code", -4) rawset(msg, "error", "AD user exists") print(json.encode(msg)) else rawset(msg, "code", -3) rawset(msg, "error", "User exists") print(json.encode(msg)) end else c_DeleteUser(domain,oldname) AddUser(domain,user) rawset(msg, "code", 0) print(json.encode(msg)) end else if resetstat ~= nil then c_ResetUserStatistic(domain,user.username) end local userdata = c_GetUser(domain,user.username) if userdata ~= nil and userdata.enable_two_factor ~= user.enable_two_factor then c_KickSessionByName(domain,user.username) end AddUser(domain,user) rawset(msg, "code", 0) print(json.encode(msg)) end end else rawset(msg, "code", -1) rawset(msg, "error", "not logged in") print(json.encode(msg)) end %>