mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Allow team admins to require two-factor authentication (#4034)
* Allow team admins to require two-factor authentication * Add API tests * Improve logic * ADd button tooltip
This commit is contained in:
@@ -23,7 +23,7 @@ import time
|
||||
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from django.test import Client
|
||||
from django.test import Client, override_settings
|
||||
from tests.base import extract_form_fields
|
||||
|
||||
from pretix.base.models import Organizer
|
||||
@@ -66,6 +66,25 @@ def test_session_auth_relative_timeout(client, user, team):
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_session_auth_password_change_required(client, user, team):
|
||||
client.login(email=user.email, password='dummy')
|
||||
user.needs_password_change = True
|
||||
user.save()
|
||||
|
||||
resp = client.get('/api/v1/organizers/')
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@override_settings(PRETIX_OBLIGATORY_2FA=True)
|
||||
def test_session_auth_2fa_setup_required(client, user, team):
|
||||
client.login(email=user.email, password='dummy')
|
||||
|
||||
resp = client.get('/api/v1/organizers/')
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_session_auth_csrf(user, team):
|
||||
team.members.add(user)
|
||||
|
||||
Reference in New Issue
Block a user