summaryrefslogtreecommitdiffstats
path: root/accounts/forms.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-02-01 20:20:16 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2016-02-02 04:23:27 +0100
commitf7984224c1c422d8e61e80abea1ea252752bdace (patch)
tree5a6c45e1c3f35b461b2bdfb87935f6879495ff7c /accounts/forms.py
parent7498b4dc956d6ea74f955027f867eab332a0fffa (diff)
downloadweb-f7984224c1c422d8e61e80abea1ea252752bdace.tar.gz
web-f7984224c1c422d8e61e80abea1ea252752bdace.tar.bz2
web-f7984224c1c422d8e61e80abea1ea252752bdace.zip
forms: Move regexp from utils
The username and username_exclude regexp are only used in the forms, so we move the definition there.
Diffstat (limited to 'accounts/forms.py')
-rw-r--r--accounts/forms.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/accounts/forms.py b/accounts/forms.py
index 8653653..82b999e 100644
--- a/accounts/forms.py
+++ b/accounts/forms.py
@@ -1,11 +1,16 @@
# -*- coding: utf-8 -*-
+import re
from flask import g, current_app, session, Markup
from flask.ext.wtf import Form
from flask.ext.login import current_user
from wtforms import TextField, PasswordField, ValidationError, BooleanField,\
validators
from wtforms.form import FormMeta
-from utils import _username_re, _username_exclude_re, NotRegexp, url_for
+from utils import NotRegexp, url_for
+
+
+_username_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9-]{1,15}$')
+_username_exclude_re = re.compile(r'^(admin|root)')
class RegisterForm(Form):