<s> from flask import current_app <EOL> from flask . ext . wtf import Form <EOL> from wtforms import TextField , PasswordField , ValidationError <EOL> from wtforms . validators import Required , Email , Length , Regexp , EqualTo <EOL> class UniqueUser ( object ) : <EOL> def __init__ ( self , message = "<STR_LIT>" ) : <EOL> self . message = message <EOL> def __call__ ( self , form , field ) : <EOL> if current_app . security . datastore . find_user ( email = field . data ) : <EOL> raise ValidationError ( self . message ) <EOL> validators = { <EOL> '<STR_LIT:email>' : [ <EOL> Required ( ) , <EOL> Email ( ) , <EOL> UniqueUser ( message = '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ] , <EOL> '<STR_LIT:password>' : [ <EOL> Required ( ) , <EOL> Length ( min = <NUM_LIT:6> , max = <NUM_LIT:50> ) , <EOL> EqualTo ( '<STR_LIT>' , message = '<STR_LIT>' ) , <EOL> Regexp ( r'<STR_LIT>' , <EOL> message = '<STR_LIT>' ) <EOL> ] <EOL> } <EOL> class RegisterForm ( Form ) : <EOL> email = TextField ( '<STR_LIT>' , validators [ '<STR_LIT:email>' ] ) <EOL> password = PasswordField ( '<STR_LIT>' , validators [ '<STR_LIT:password>' ] , ) <EOL> confirm = PasswordField ( '<STR_LIT>' ) </s>
