summaryrefslogtreecommitdiffstats
path: root/password-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'password-model.lua')
-rw-r--r--password-model.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/password-model.lua b/password-model.lua
new file mode 100644
index 0000000..33dffbd
--- /dev/null
+++ b/password-model.lua
@@ -0,0 +1,19 @@
+-- password model methods
+module (..., package.seeall)
+strsplit = require "split"
+
+-- no initializer in model - use controller.init for that
+
+get = function (self)
+ f = io.open ("/etc/shadow")
+ c = f:read("*l")
+ temp = strsplit(":", c)
+ if temp[2] == "!" then
+ status = "not set"
+ else
+ status = "set"
+ end
+ f:close()
+ return (cfe{value=status, name="password"})
+end
+