def setLogin(self, username, password): login_ok = UserModel.Users.checkLogin(username, password) if login_ok: session = amiweb.session() session['logged_in'] = True session['username'] = username self.setViewEditMode("on") AmiCache.expireEditPages() page = Model.Pages.getPageById(getCurrentPage()) ns = {'template': self.template, 'full_link': page.getFullLink()} return render("skeletonz/view/whole_sites/login_ok.tmpl", ns)
def setLogout(self, id): session = amiweb.session() try: id = int(id) except: id = getCurrentPage() session['logged_in'] = False session['username'] = None AmiCache.expireEditPages() page = Model.Pages.getPageById(id) url = "%s/%s" % (BASE_URL, page.getFullLink()) raise amiweb.HTTPFound(url)
def setViewEditMode(self, value): amiweb.session()['view_edit_mode'] = value AmiCache.expireEditPages()