summaryrefslogtreecommitdiffstats
path: root/py-bin/login.py
blob: 2fd85b37b4f7e31e4401ef56b1b5fe0a91227a81 (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
#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