Permalink
Browse files

fix #311 (#313)

* Update views.py

* Update views.py

* Update views.py

* Update views.py

* Update views.py
  • Loading branch information...
1 parent 59c689c commit 124e26fa325fa7cb7e5a2385dbce050ae4b7c9ae @peter17919 peter17919 committed with ibuler Nov 3, 2016
Showing with 5 additions and 1 deletion.
  1. +5 −1 juser/views.py
View
@@ -10,6 +10,7 @@
from django.db.models import Q
from juser.user_api import *
from jperm.perm_api import get_group_user_perm
+import re
MAIL_FROM = EMAIL_HOST_USER
@@ -142,7 +143,7 @@ def user_add(request):
group_all = UserGroup.objects.all()
if request.method == 'POST':
- username = request.POST.get('username', '')
+ username = request.POST.get('username', '')
password = PyCrypt.gen_rand_pass(16)
name = request.POST.get('name', '')
email = request.POST.get('email', '')
@@ -173,6 +174,9 @@ def user_add(request):
pass
else:
try:
+ if not re.match(r"^\w+$",username):
+ error = u'用户名不合法'
+ raise ServerError(error)
user = db_add_user(username=username, name=name,
password=password,
email=email, role=role, uuid=uuid_r,

0 comments on commit 124e26f

Please sign in to comment.