(self, path)
| 31 | last_cleanup = time.time() |
| 32 | |
| 33 | def route(self, path): |
| 34 | # Restict Ui access by ip |
| 35 | if config.ui_restrict and self.env['REMOTE_ADDR'] not in config.ui_restrict: |
| 36 | return self.error403(details=False) |
| 37 | if path.endswith("favicon.ico"): |
| 38 | return self.actionFile("src/Ui/media/img/favicon.ico") |
| 39 | else: |
| 40 | if config.ui_password: |
| 41 | if time.time() - self.last_cleanup > 60 * 60: # Cleanup expired sessions every hour |
| 42 | self.cleanup() |
| 43 | # Validate session |
| 44 | session_id = self.getCookies().get("session_id") |
| 45 | if session_id not in self.sessions: # Invalid session id, display login |
| 46 | return self.actionLogin() |
| 47 | return super(UiRequestPlugin, self).route(path) |
| 48 | |
| 49 | # Action: Login |
| 50 | @helper.encodeResponse |
nothing calls this directly
no test coverage detected