def login(self, username, password): try: self.current_user = self.auth.logIn(username, password) self.error_message = None sessionState.set("username", username) sessionState.set("source", self.current_user.getSource()) self.has_error = False except AuthenticationException, e: self.current_user = None self.error_message = self.parse_error(e)
def logout(self): if self.current_user is not None: try: self.auth.logOut(self.current_user) self.current_user = None self.error_message = None sessionState.set("username", None) sessionState.set("source", None) self.has_error = False except AuthenticationException, e: self.error_message = self.parse_error(e)