Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /fief-dev_fief /fief /apps /dashboard /validators.py
| import re | |
| from wtforms import validators | |
| from fief.services.localhost import is_localhost | |
| from fief.settings import settings | |
| class NotHTTPSURLValidationError(validators.ValidationError): | |
| def __init__(self): | |
| super().__init__("An HTTPS URL is required.") | |
| class RedirectURLValidator(validators.Regexp): | |
| def __init__(self, message=None): | |
| regex = ( | |
| r"^(?P<scheme>[a-z]+)://" | |
| r"(?P<host>[^\/\?:]+)" | |
| r"(?P<port>:[0-9]+)?" | |
| r"(?P<path>\/.*?)?" | |
| r"(?P<query>\?.*)?$" | |
| ) | |
| super().__init__(regex, re.IGNORECASE, message) | |
| def __call__(self, form, field): | |
| message = self.message | |
| if message is None: | |
| message = "Invalid URL." | |
| match = super().__call__(form, field, message) | |
| scheme = match.group("scheme") | |
| host = match.group("host") | |
| if ( | |
| settings.client_redirect_uri_ssl_required | |
| and scheme == "http" | |
| and not is_localhost(host) | |
| ): | |
| raise NotHTTPSURLValidationError() | |
Xet Storage Details
- Size:
- 1.07 kB
- Xet hash:
- a9a81ae8e06fe4800452048aa02d790bc470274cb0642cbc45632f44e52f81cf
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.