summaryrefslogtreecommitdiffstats
path: root/tmppassword-controller.lua
blob: c19d6b438fc3d17a9430a8f917e36a4418dc3fd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module(..., package.seeall)

local list_redir = function (self)
	self.conf.action = "status"
	self.conf.type = "redir"
	error (self.conf)
end

mvc = {}
mvc.on_load = function(self, parent)
	if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
		self.worker[self.conf.action] = list_redir(self)
	end
end

function status(self)
	local status=self.model.getstatus(self)
	status.cmdnew = cfe ({
		name="cmdnew",
		type="submit",
		label="Create new account",
		value="Create",
		disabled="yes",
		})
	return { status=status }
end

function edit(self)
	local config=self.model.getsettings(self.clientdata.userid)
	config.cmdsave = cfe ({
		name="cmdsave",
		type="submit",
		label="Save changes",
		value="Save",
		disabled="yes",
		})
	config.cmddelete = cfe ({
		name="cmddelete",
		type="submit",
		label="Delete this account",
		value="Delete",
		disabled="yes",
		})

	return { config=config, clientdata=self.clientdata }
end