Added new fields: usernamefield and fix in passwordfield

This commit is contained in:
Antonio de la Rosa 2019-07-15 00:23:43 +02:00
parent 9cb9978a86
commit 87bc64a673
3 changed files with 38 additions and 3 deletions

View 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