fasthtml-auth 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fasthtml_auth/__init__.py +1 -1
- fasthtml_auth/middleware.py +8 -1
- {fasthtml_auth-0.1.0.dist-info → fasthtml_auth-0.1.1.dist-info}/METADATA +1 -1
- {fasthtml_auth-0.1.0.dist-info → fasthtml_auth-0.1.1.dist-info}/RECORD +7 -7
- {fasthtml_auth-0.1.0.dist-info → fasthtml_auth-0.1.1.dist-info}/WHEEL +0 -0
- {fasthtml_auth-0.1.0.dist-info → fasthtml_auth-0.1.1.dist-info}/licenses/LICENSE +0 -0
- {fasthtml_auth-0.1.0.dist-info → fasthtml_auth-0.1.1.dist-info}/top_level.txt +0 -0
fasthtml_auth/__init__.py
CHANGED
fasthtml_auth/middleware.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from fasthtml.common import *
|
2
|
+
import inspect
|
2
3
|
from typing import Optional, List
|
3
4
|
|
4
5
|
class AuthBeforeware:
|
@@ -98,7 +99,13 @@ class AuthBeforeware:
|
|
98
99
|
user = req.scope.get('user')
|
99
100
|
if not user or user.role not in allowed_roles:
|
100
101
|
return Response("Forbidden", status_code=403)
|
101
|
-
|
102
|
+
|
103
|
+
# Check if function accepts extra args
|
104
|
+
sig = inspect.signature(func)
|
105
|
+
if len(sig.parameters) == 1: # Only takes req
|
106
|
+
return func(req)
|
107
|
+
else:
|
108
|
+
return func(req, *args, **kwargs)
|
102
109
|
return wrapper
|
103
110
|
return decorator
|
104
111
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fasthtml-auth
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.1
|
4
4
|
Summary: Complete authentication system for FastHTML applications with beautiful UI, role-based access control, and session management
|
5
5
|
Author-email: John Richmond <confusedjohn46@gmail.com>
|
6
6
|
Maintainer-email: John Richmond <confusedjohn46@gmail.com>
|
@@ -1,15 +1,15 @@
|
|
1
|
-
fasthtml_auth/__init__.py,sha256=
|
1
|
+
fasthtml_auth/__init__.py,sha256=UVSTTV7vZ8VcFB8bWNhjJLCwnYYElCLhQmryYo6eiwA,780
|
2
2
|
fasthtml_auth/database.py,sha256=xVSqZD8-zA1qq166LsQMQvxMkMaJhLfIv1QIXX0Bgvc,1079
|
3
3
|
fasthtml_auth/forms.py,sha256=zlgaq5cmHQspjwyz5e48yuC03JL5D4dSm_6gOKnBnP0,15163
|
4
4
|
fasthtml_auth/init.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
fasthtml_auth/manager.py,sha256=1sI6S4HLji9FdZNxPCp-73wsihkyaNvCG_DzibfazDk,2663
|
6
|
-
fasthtml_auth/middleware.py,sha256
|
6
|
+
fasthtml_auth/middleware.py,sha256=-nbnyJ71fouAz904iMpL4OuWbRn-T-zL02X_nYxK89E,3600
|
7
7
|
fasthtml_auth/models.py,sha256=WMZuvW9ikB9y8Zql4Q68ItvzVYxNkGuLWsR5gnPp86w,2323
|
8
8
|
fasthtml_auth/repository.py,sha256=27j7ps4RurezPKUjGBMhUGQBofRER2GeSFgSe7FPjic,4395
|
9
9
|
fasthtml_auth/routes.py,sha256=6NBLxppYi53SfUjyMnXLb3gzl9GlswqdTZgEg36-FGc,9025
|
10
10
|
fasthtml_auth/utils.py,sha256=NsdmkcxVLfahe_BVc8GqawadwJgilX6NbZt-gMdiibk,1451
|
11
|
-
fasthtml_auth-0.1.
|
12
|
-
fasthtml_auth-0.1.
|
13
|
-
fasthtml_auth-0.1.
|
14
|
-
fasthtml_auth-0.1.
|
15
|
-
fasthtml_auth-0.1.
|
11
|
+
fasthtml_auth-0.1.1.dist-info/licenses/LICENSE,sha256=EnPW65jfIuV5msUjRTyzltVV2Aqo3HcIyM6z3hUloXQ,1064
|
12
|
+
fasthtml_auth-0.1.1.dist-info/METADATA,sha256=wKpRxwJqqj7NjcFHhI6aOtyxoDiY-h4-dygX3Nua-cc,12395
|
13
|
+
fasthtml_auth-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
14
|
+
fasthtml_auth-0.1.1.dist-info/top_level.txt,sha256=uG6b_v5AONQHyoez8FVziIAf9ORW0Ri_mUaU0yNwMWk,14
|
15
|
+
fasthtml_auth-0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|