# -*- coding: utf-8 -*-
from ocyan.core.plugins import OcyanPluginConfig


class Wagtail2FaConfig(OcyanPluginConfig):
    def contribute_to_installed_apps(self, installed_apps):
        installed_apps.ocyan.append("ocyan.plugin.wagtail_2fa")
        installed_apps.apps.append("wagtail_2fa")
        installed_apps.apps.append("django_otp")
        installed_apps.apps.append("django_otp.plugins.otp_totp")
        return installed_apps

    def contribute_to_middleware(self, middleware):
        middleware += [
            "wagtail_2fa.middleware.VerifyUserMiddleware",
            "ocyan.plugin.wagtail_2fa.middleware.ExpiredSessionMiddleware",
        ]
        return middleware
