diff options
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -20,7 +20,7 @@ from wtforms.validators import Regexp -_username_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9-]{1,15}') +_username_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9-]{1,15}$') _username_exclude_re = re.compile(r'^(admin|root)') # using http://flask.pocoo.org/docs/patterns/viewdecorators/ @@ -234,7 +234,8 @@ def url_for(endpoint, **values): """Wrap `flask.url_for` so that it always returns https links""" #XXX: Drop this in favor of config.PREFERRED_URL_SCHEME when we require Flask 0.9 u = flask_url_for(endpoint, **values) - if '_external' in values and u.startswith('http://'): + if '_external' in values and u.startswith('http://') \ + and current_app.config['PREFERRED_URL_SCHEME'] == 'https': return 'https://' + u[7:] else: return u |