1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 django,
6 setuptools,
7 pyotp,
8 fido2,
9 qrcode,
10 python,
11 fetchpatch,
12}:
13
14buildPythonPackage rec {
15 pname = "django-mfa3";
16 version = "0.13.0";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "xi";
21 repo = "django-mfa3";
22 rev = "refs/tags/${version}";
23 hash = "sha256-O8po7VevqyHlP2isnNnLbpgfs1p4sFezxIZKMTgnwuY=";
24 };
25
26 patches = [
27 # Fix for tests.tests.FIDO2Test.test_origin_https
28 # https://github.com/xi/django-mfa3/issues/24
29 (fetchpatch {
30 url = "https://github.com/xi/django-mfa3/commit/49003746783e32cd60e55c4593bef5d7e709c4bd.patch";
31 hash = "sha256-D3fPURAB+RC16fSd2COpCIcmjZW/1h92GOOhRczSVec=";
32 name = "test_origin_https_fix.patch";
33 })
34 ];
35
36 build-system = [ setuptools ];
37
38 dependencies = [
39 django
40 pyotp
41 fido2
42 qrcode
43 ];
44
45 # qrcode 8.0 not supported yet
46 # See https://github.com/xi/django-mfa3/pull/14
47 pythonRelaxDeps = [ "qrcode" ];
48
49 checkPhase = ''
50 ${python.interpreter} -m django test --settings tests.settings
51 '';
52
53 meta = {
54 description = "Multi factor authentication for Django";
55 homepage = "https://github.com/xi/django-mfa3";
56 changelog = "https://github.com/xi/django-mfa3/blob/${src.rev}/CHANGES.md";
57 license = lib.licenses.mit;
58 maintainers = [ lib.maintainers.onny ];
59 };
60}