##// END OF EJS Templates
added validation of username alphanumeric+dash only
marcink -
r743:c9fa3f53 beta
parent child Browse files
Show More
@@ -35,6 +35,7 from rhodecode import BACKENDS
35 35 import formencode
36 36 import logging
37 37 import os
38 import re
38 39 import rhodecode.lib.helpers as h
39 40
40 41 log = logging.getLogger(__name__)
@@ -71,7 +72,16 def ValidUsername(edit, old_data):
71 72 case_insensitive=True):
72 73 raise formencode.Invalid(_('This username already exists') ,
73 74 value, state)
74
75
76
77 if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-]+$', value) is None:
78 raise formencode.Invalid(_('Username may only contain '
79 'alphanumeric characters '
80 'or dashes and cannot begin with a dash'),
81 value, state)
82
83
84
75 85 return _ValidUsername
76 86
77 87 class ValidPassword(formencode.validators.FancyValidator):
@@ -2303,6 +2303,7 display:block;
2303 2303 color:red;
2304 2304 margin:8px 0 0;
2305 2305 padding:0;
2306 width: 320px;
2306 2307 }
2307 2308
2308 2309 #login div.form div.fields div.field div.label label,#register div.form div.fields div.field div.label label {
General Comments 0
You need to be logged in to leave comments. Login now