core/usermanager.lua

Sat, 04 Oct 2008 15:25:54 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 04 Oct 2008 15:25:54 +0100
changeset 53
14ea0fe6ca86
parent 38
3fdfd6e0cb4e
child 60
44800be871f5
permissions
-rw-r--r--

Session destruction fixes, some debugging code while we fix the rest. Also change logger to be more useful.

0
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
1
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
2 require "util.datamanager"
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
3 local datamanager = datamanager;
53
14ea0fe6ca86 Session destruction fixes, some debugging code while we fix the rest. Also change logger to be more useful.
Matthew Wild <mwild1@gmail.com>
parents: 38
diff changeset
4 local log = require "util.logger".init("usermanager");
0
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
5
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
6 module "usermanager"
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
7
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
8 function validate_credentials(host, username, password)
53
14ea0fe6ca86 Session destruction fixes, some debugging code while we fix the rest. Also change logger to be more useful.
Matthew Wild <mwild1@gmail.com>
parents: 38
diff changeset
9 log("debug", "User '%s' is being validated", username);
0
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
10 local credentials = datamanager.load(username, host, "accounts") or {};
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
11 if password == credentials.password then return true; end
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
12 return false;
3e3171b59028 First commit, where do you want to go tomorrow?
matthew
parents:
diff changeset
13 end
38
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
14
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
15 return _M;

mercurial