Added new fields: usernamefield and fix in passwordfield
This commit is contained in:
parent
9cb9978a86
commit
87bc64a673
3 changed files with 38 additions and 3 deletions
16
paramecio/cromosoma/extrafields/usernamefield.py
Normal file
16
paramecio/cromosoma/extrafields/usernamefield.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from paramecio.cromosoma.corefields import PhangoField
|
||||
from paramecio.cromosoma.coreforms import PasswordForm
|
||||
from hmac import compare_digest as compare_hash
|
||||
import crypt
|
||||
import re
|
||||
|
||||
class UserNameField(PhangoField):
|
||||
|
||||
def check(self, value):
|
||||
|
||||
if not re.match("^[A-Za-z0-9_-]+$", value):
|
||||
self.txt_error='Error: use only letters, numbers, underscores and dashes for this field'
|
||||
self.error=1
|
||||
value=''
|
||||
|
||||
return value
|
||||
Loading…
Add table
Add a link
Reference in a new issue