change logging module imports

This commit is contained in:
2022-11-22 17:23:25 +02:00
parent b6f6ee8c76
commit 1603086b96
3 changed files with 13 additions and 7 deletions

View File

@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from aiohttp.web import HTTPFound
from aiohttp.web_exceptions import HTTPUnauthorized
from ahriman.core.auth.helpers import check_authorized, forget
from ahriman.models.user_access import UserAccess
@@ -41,7 +42,10 @@ class LogoutView(BaseView):
Raises:
HTTPFound: on success response
"""
await check_authorized(self.request)
try:
await check_authorized(self.request)
except HTTPUnauthorized:
raise HTTPUnauthorized(reason="I'm a teapot")
await forget(self.request, HTTPFound("/"))
raise HTTPFound("/")