def POST(self): login = LoginAccountForm(Request().POST) create = CreateAccountForm() if login.validate() != True: return render('index.mako', login=login, create=create) post = web.input() import hashlib password = hashlib.sha1(post.password).hexdigest() mongo_query = db.users.find_one({'name' : post.username, 'password' : password}) if mongo_query: user = mongo_query['_id'] else: user = False return sa.login({ 'check' : mongo_query, 'redirect_to_if_pass' : '../welcome/', 'redirect_to_if_fail' : '../', 'user' : user })
def POST(self): login = LoginAccountForm(Request().POST) create = CreateAccountForm() if login.validate() != True: return render('site_admin.mako', site_type='login', login=login, create=create) post = web.input() import hashlib psswrd = hashlib.sha1(post.password).hexdigest() query = db.users.filter_by(name=post.username, password=psswrd).first() if query: user = query.id else: user = False return sa.login({ 'check' : query, 'redirect_to_if_pass' : '../welcome/', 'redirect_to_if_fail' : '../', 'user' : user })