Example #1
0
    def go(self, comp):
        user = security.get_user()
        while user is None:
            # not logged ? Call login component
            comp.call(
                self._services(
                    login.Login,
                    self.app_title,
                    self.app_banner,
                    self.theme,
                    self.cfg,
                ))
            user = security.get_user()
            if user.last_login is None:
                # first connection.
                # Load template boards if any,
                self.app.boards_manager.create_boards_from_templates(
                    user.data, self.cfg['tpl_cfg'])
                #  then index cards
                self.app.boards_manager.index_user_cards(
                    user.data, self.search_engine)
            user.update_last_login()

        comp.call(self.app.initialization())
        # Logout
        if user is not None:
            security.get_manager().logout()
Example #2
0
    def go(self, comp):
        user = security.get_user()
        while user is None:
            # not logged ? Call login component
            comp.call(
                self._services(
                    login.Login,
                    self.app_title,
                    self.app_banner,
                    self.custom_css,
                    self.cfg,
                )
            )
            user = security.get_user()
            if user.last_login is None:
                # first connection.
                # Load template boards if any,
                self.app.boards_manager.create_boards_from_templates(user.data, self.cfg['tpl_cfg'])
                #  then index cards
                self.app.boards_manager.index_user_cards(user.data,
                                                         self.search_engine)
            user.update_last_login()

        comp.call(self.app.initialization())
        # Logout
        if user is not None:
            security.get_manager().logout()
    def commit(self):
        if not super(PasswordEditor, self).commit(
            (), ('password', 'password_confirm')):
            return False  # failure

        user = self.user
        user.change_password(self.password.value)
        security.get_manager().update_current_user_credentials()
        flashmessage.set_flash(_(u'Your password has been changed'))
        return True  # success
Example #4
0
    def commit(self):
        if not super(PasswordEditor, self).commit(
                (),
                ('password', 'password_confirm')):
            return False  # failure

        user = self.user
        user.change_password(self.password.value)
        security.get_manager().update_current_user_credentials()
        flashmessage.set_flash(_(u'Your password has been changed'))
        return True  # success
Example #5
0
    def go(self, comp):
        user = security.get_user()
        while user is None:
            # not logged ? Call login component
            comp.call(
                self._services(login.Login, self.app_title, self.app_banner,
                               self.favicon, self.theme, self.config))
            user = security.get_user()
            user.update_last_login()

        comp.call(self.app.initialization())
        # Logout
        if user is not None:
            security.get_manager().logout()
Example #6
0
    def go(self, comp):
        user = security.get_user()
        while user is None:
            # not logged ? Call login component
            comp.call(
                self._services(
                    login.Login,
                    self.app_title,
                    self.app_banner,
                    self.favicon,
                    self.theme,
                    self.config
                )
            )
            user = security.get_user()
            user.update_last_login()

        comp.call(self.app.initialization())
        # Logout
        if user is not None:
            security.get_manager().logout()
Example #7
0
                        if session.back_used:
                            output = self.on_back(request, response, renderer, output)

                        if not xhr_request:
                            output = top.wrap(renderer.content_type, renderer, output)

                        self._phase2(output, renderer.content_type, renderer.doctype, render is not None, response)

                        if not xhr_request:
                            # TODO: move it into a ``renderer.end_rendering()`` method
                            callbacks.clear_not_used(renderer._rendered)

                    # Store the session
                    session.set(use_same_state, (root, callbacks))

                    security.get_manager().end_rendering(request, response, session)
                except exc.HTTPException, response:
                    # When a ``webob.exc`` object is raised during phase 2, stop immediately
                    # use it as the response object
                    pass
                except Exception:
                    self.last_exception = (request,  sys.exc_info())
                    response = self.on_exception(request, response)
            finally:
                if session:
                    session.release()

        return response(environ, start_response)

# ---------------------------------------------------------------------------
Example #8
0
 def __enter__(self):
     """Push these security rules to the stack
     """
     self._previous_rules = security.get_manager()
     security.set_manager(self)
Example #9
0
def logout():
    if security.get_user() is not None:
        security.get_manager().logout()
Example #10
0
def logout():
    if security.get_user() is not None:
        security.get_manager().logout()
Example #11
0
 def logout(self):
     security.get_manager().logout()
Example #12
0
 def logout(self):
     security.get_manager().logout()
     self.login_box.becomes(Login())
Example #13
0
 def logout(self):
     security.get_manager().logout()
     self.login_box.becomes(Login())
Example #14
0
                        # If the phase 1 has returned a render function, use it
                        # else, start the rendering by the application root component
                        output = render(renderer) if render else root.render(renderer)

                        if state.back_used:
                            output = self.on_back(request, response, renderer, output)

                        if not xhr_request:
                            output = top.wrap(renderer.content_type, renderer, output)

                        self._phase2(output, renderer.content_type, renderer.doctype, xhr_request, response)

                    # Store the state
                    state.set_root(use_same_state, root)

                    security.get_manager().end_rendering(request, response, state)
                except exc.HTTPException, response:
                    # When a ``webob.exc`` object is raised during phase 2, stop immediately
                    # use it as the response object
                    pass
                except Exception:
                    self.last_exception = (request, sys.exc_info())
                    response = self.on_exception(request, response)
            finally:
                if state:
                    state.release()

        return response(environ, start_response)


# ---------------------------------------------------------------------------
Example #15
0
 def __enter__(self):
     """Push these security rules to the stack
     """
     self._previous_rules = security.get_manager()
     security.set_manager(self)
Example #16
0
 def logout(self):
     security.get_manager().logout()
Example #17
0
                        if state.back_used:
                            output = self.on_back(request, response, renderer,
                                                  output)

                        if not xhr_request:
                            output = top.wrap(renderer.content_type, renderer,
                                              output)

                        self._phase2(output, renderer.content_type,
                                     renderer.doctype, xhr_request, response)

                    # Store the state
                    state.set_root(use_same_state, root)

                    security.get_manager().end_rendering(
                        request, response, state)
                except exc.HTTPException, response:
                    # When a ``webob.exc`` object is raised during phase 2, stop immediately
                    # use it as the response object
                    pass
                except Exception:
                    self.last_exception = (request, sys.exc_info())
                    response = self.on_exception(request, response)
            finally:
                if state:
                    state.release()

        return response(environ, start_response)


# ---------------------------------------------------------------------------