summaryrefslogtreecommitdiffstats
path: root/py-bin/login.py
diff options
context:
space:
mode:
Diffstat (limited to 'py-bin/login.py')
-rw-r--r--py-bin/login.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/py-bin/login.py b/py-bin/login.py
new file mode 100644
index 0000000..2fd85b3
--- /dev/null
+++ b/py-bin/login.py
@@ -0,0 +1,24 @@
+#login
+
+import config
+
+class LoginMixIn:
+ def login_form(self, req):
+ self.render_template(req, "login_form.em")
+ login_form.web_callable = True
+
+ def login_process(self, req):
+ email = req.params.get("email", "")
+ jabberpw = req.params.get("jabberpw", "")
+
+ success, status_or_user = self.jman.login(email, jabberpw)
+ if not success:
+ return self.failed_page(req, status_or_user)
+
+ self.redirect_to(req, config.script_url + "?cmd=setup_main")
+ login_process.web_callable = True
+
+ def failed_page(self, req, reason):
+ self.render_template(req, "login_fail.em", dict(reason=reason))
+ return None
+