Ejemplo n.º 1
0
class LoginForm(Form):
    username = StringField(validators=[
        DataRequired(__('Please, provide your username validation message'))
    ],
                           widget=WidgetPrebind(
                               TextInput(),
                               class_='uk-width-1-1 uk-form-large',
                               placeholder=__('Username placeholder'),
                               autofocus=True,
                               size=30))
    password = PasswordField(validators=[
        DataRequired(__('Please, provide your password validation message'))
    ],
                             widget=WidgetPrebind(
                                 PasswordInput(),
                                 class_='uk-width-1-1 uk-form-large',
                                 placeholder=__('Password placeholder'),
                                 size=30,
                                 autocomplete='off'))
    remember_me = BooleanField(__('Remember me label'), default=False)
    next = HiddenField()

    def __init__(self, *args, **kwargs):
        super(LoginForm, self).__init__(*args, **kwargs)
        self.user = None

    def validate(self, **kwargs):
        if not Form.validate(self):
            return False

        user = User.get_by_username(self.username.data)

        if not user or not user.check_password(self.password.data):
            self.errors.update({
                'form':
                [__('Invalid username or password validation message')]
            })
            return False

        self.user = user
        return True
Ejemplo n.º 2
0
class LoginForm(FlaskForm):

    email = StringField(
        'Email',
        validators=[
            DataRequired(message='Please enter an email'),
            Email(message='Please enter a valid email'),
        ],
    )

    password = StringField(
        'Password',
        validators=[
            DataRequired(message='Please enter a password'),
        ],
        widget=PasswordInput(hide_value=False),
    )

    remember_me = BooleanField('Remember Me')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.user = None

    def validate_on_submit(self):
        if not super().validate_on_submit():
            return False

        self.user = User.objects(email=self.email.data).first()

        if not self.user or not self.user.verify_password(self.password.data):
            self.email.errors.append('Incorrect email')
            self.password.errors.append('Incorrect password')
            return False

        if not self.user.is_active:
            self.email.errors.append(
                'Please verify your email before logging in', )
            return False

        return True
Ejemplo n.º 3
0
class EnpointSipForm(BaseForm):
    id = HiddenField()
    name = StringField(l_('Name'),
                       validators=[InputRequired(),
                                   Length(max=40)])
    username = StringField(l_('Username'),
                           validators=[InputRequired(),
                                       Length(max=40)])
    secret = StringField(l_('Password'),
                         validators=[Length(max=80)],
                         widget=PasswordInput(hide_value=False))
    type = SelectField(l_('Type'),
                       choices=[('user', l_('User')), ('peer', l_('Peer')),
                                ('friend', l_('Friend'))])
    host = SelectField(l_('Host'),
                       validators=[InputRequired(),
                                   Length(max=255)],
                       choices=[('dynamic', l_('Dynamic')),
                                ('static', l_('Static'))])
    host_value = StringField('', validators=[Length(max=255)])
    options = FieldList(FormField(OptionsForm))
Ejemplo n.º 4
0
class DBConfigForm(ConfigForm):
    """
    Complete form for editing a dbconfig-common generated for PHP.
    """
    legend = 'Database'
    description = 'Settings for connecting to the database.'
    dbtype = TextField('Database type')
    dbserver = TextField('Host')
    dbport = IntegerField('Port', [Optional(), NumberRange(1, 65535)])
    dbname = TextField('Database name')
    dbuser = TextField('Username')
    dbpass = PasswordField('Password', widget=PasswordInput(hide_value=False))

    def db_handler(self, varname, default):
        pattern = r'\$%s=\'(.*)\';' % varname
        writer = lambda x: '$%s=\'%s\';' % (varname, x)
        return RegexHandler(pattern,
                            writer,
                            inserter=php_inserter,
                            default=default)

    def __init__(self, filename, *args, **kwargs):
        if not self.config:
            self.config = FileConfig(filename, [
                ('dbtype',
                 self.db_handler('dbtype', kwargs.pop('dbtype', 'mysql'))),
                ('dbserver',
                 self.db_handler('dbserver', kwargs.pop(
                     'dbserver', 'localhost'))),
                ('dbport', self.db_handler('dbport', kwargs.pop('dbport',
                                                                ''))),
                ('dbname', self.db_handler('dbname', kwargs.pop('dbname',
                                                                ''))),
                ('dbuser', self.db_handler('dbuser', kwargs.pop('dbuser',
                                                                ''))),
                ('dbpass', self.db_handler('dbpass', kwargs.pop('dbpass',
                                                                ''))),
            ])

        super(DBConfigForm, self).__init__(*args, **kwargs)
Ejemplo n.º 5
0
class UpdateEmailForm(FlaskForm):

    email = StringField(
        'Email',
        validators=[
            DataRequired(message='Please enter an email'),
            Email(message='Please enter a valid email'),
        ],
    )

    password = StringField(
        'Password Confirmation',
        validators=[
            DataRequired(message='Please enter your password'),
        ],
        widget=PasswordInput(hide_value=False),
    )

    def validate_on_submit(self):
        if not super().validate_on_submit():
            return False

        if not current_user.verify_password(self.password.data):
            self.password.errors.append('Incorrect password')
            return False

        existing_user = User.objects(email=self.email.data).first()

        if current_user.email != self.email.data and existing_user:
            self.email.errors.append(
                'There is already an account with this email',
            )
            return False

        return True

    def update_needed(self):
        return self.email.data != current_user.email
Ejemplo n.º 6
0
class UserForm(FlaskForm):
    name = StringField('Nimi', [required(), Length(min=2, max=50)],
                       render_kw={
                           'class': 'form-control form-control-sm',
                           'pattern': '.{2,50}'
                       })
    phone = StringField(
        'Puhelinnumero',
        [required(), Length(min=5, max=20),
         Regexp('[0-9]{5,20}')],
        render_kw={
            'class': 'form-control form-control-sm',
            'pattern': '[0-9]{5,20}'
        })
    address = StringField('Osoite',
                          [required(), Length(min=2, max=50)],
                          render_kw={
                              'class': 'form-control form-control-sm',
                              'pattern': '.{2,50}'
                          })
    admin = BooleanField('Ylläpitäjä', [optional()],
                         render_kw={'class': 'custom-control-input'})
    username = StringField('Käyttäjätunnus',
                           [required(), Length(min=2, max=50)],
                           render_kw={
                               'class': 'form-control form-control-sm',
                               'pattern': '.{2,50}'
                           })
    password = StringField('Salasana',
                           [required(), Length(min=2, max=50)],
                           widget=PasswordInput(hide_value=False),
                           render_kw={
                               'class': 'form-control form-control-sm',
                               'pattern': '.{2,50}'
                           })

    class Meta:
        csrf = False
Ejemplo n.º 7
0
class TeacherForm(FlaskForm):
    email = StringField('Email',
                        validators=[
                            InputRequired(),
                            Email(message='Invalid email'),
                            Length(max=30)
                        ])
    title = SelectField('Title',
                        validators=[DataRequired()],
                        choices=[('', 'Select title'), ('Mrs', 'Mrs'),
                                 ('Miss', 'Miss'), ('Ms', 'Ms'), ('Mr', 'Mr'),
                                 ('Dr.', 'Dr.'), ('Prof.', 'Prof.')])
    name = StringField('First Name', validators=[InputRequired()])
    surname = StringField('Last Name', validators=[InputRequired()])
    password = StringField('Password', widget=PasswordInput(hide_value=False))
    # here we need a DropDown field for school
    # coerce this property is saying that the select value will be string type
    school = SelectField('School',
                         coerce=str,
                         validators=[DataRequired()],
                         id='school')
    school_name = StringField('School Name')
    submit = SubmitField('Register')
Ejemplo n.º 8
0
class AddClientForm(FlaskForm):
    username = StringField(
        'Username',
        validators=[
            DataRequired(),
            Length(min=2, max=20),
            Unique(Radusergroup,
                   Radusergroup.username,
                   message='There is already an user with that name!')
        ])

    # We use a widget here to enable population of the pwd field
    password = StringField('Password',
                           widget=PasswordInput(hide_value=False),
                           validators=[DataRequired(),
                                       Length(min=2, max=20)])

    profile = SelectField(u'Internet Profile',
                          choices=internet_profile_query())

    # delete = SubmitField('Delete User')

    submit = SubmitField('Save')
Ejemplo n.º 9
0
class UserProfileForm(FlaskForm):
    first_name = StringField(word('First name'),
                             [validators.Length(min=0, max=255)])
    last_name = StringField(word('Last name'),
                            [validators.Length(min=0, max=255)])
    country = StringField(word('Country code'),
                          [validators.Length(min=0, max=2)])
    subdivisionfirst = StringField(word('First subdivision'),
                                   [validators.Length(min=0, max=64)])
    subdivisionsecond = StringField(word('Second subdivision'),
                                    [validators.Length(min=0, max=64)])
    subdivisionthird = StringField(word('Third subdivision'),
                                   [validators.Length(min=0, max=64)])
    organization = StringField(word('Organization'),
                               [validators.Length(min=0, max=64)])
    language = StringField(word('Language'),
                           [validators.Length(min=0, max=64)])
    timezone = SelectField(word('Time Zone'))
    pypi_username = StringField(word('PyPI Username'))
    pypi_password = StringField(word('PyPI Password'),
                                widget=PasswordInput(hide_value=False))
    confirmed_at = DateField(word('Confirmation Date'))
    submit = SubmitField(word('Save'))
Ejemplo n.º 10
0
Archivo: app.py Proyecto: DerwenAI/stor
class LoginForm(FlaskForm):
    ## http://flask-wtf.readthedocs.io/
    ## https://github.com/marcelomd/flask-wtf-login-example

    email = StringField(
        "email",
        validators=[
            InputRequired(message="please enter your email address"),
            Email(message="this field requires a valid email address"),
            Length(max=255),
        ])

    password = PasswordField(
        "password",
        widget=PasswordInput(hide_value=False),
        validators=[
            InputRequired(
                message="please enter the password for this account"),
            Length(max=255),
        ])

    #remember_me = BooleanField("remember me")
    submit = SubmitField("login")
Ejemplo n.º 11
0
class UpdateForm(DataForm):
    opassword = StringField("Old Password",
                            widget=PasswordInput(hide_value=False))
    password = PasswordField("New Password")
    cpassword = PasswordField(
        "Confirm Password",
        validators=[EqualTo('password', "Password mismatch")])

    def validate_opassword(self, field):

        if field.data != "":
            self.password.validators = [DataRequired()]

            good = False
            user = None

            if not any(['admin' in session, 'voter' in session]):
                if request.url == url_for("main.candidate", _external=True):
                    user = current_user
                else:
                    user = current_user.user_data
            else:
                user = current_user

            if user and user.verify_password(field.data): good = True

            if not good:
                raise ValidationError("Sorry, invalid password")

    def validate_password(self, field):
        if field.data != "":
            try:
                if self.opassword.data == field.data:
                    raise ValidationError(
                        "Sorry, you can't use your former password")
            except Exception as e:
                self.password.validators = [DataRequired()]
Ejemplo n.º 12
0
class LoginForm(FlashErrorsForm):
    """ Form for logging in. Prefills with session information. """

    def __init__(self, **kwargs):
        kwargs["data"] = kwargs.get("data") or {}
        kwargs["data"].update(key_password_return())

        super().__init__(**kwargs)

    key = StringField("User", validators=[InputRequired()])

    # allow password to be set
    password = StringField(
        "Password",
        widget=PasswordInput(hide_value=False),
        validators=[InputRequired()],
    )

    link = SubmitField("Link Accounts", validators=[Optional()])

    def get_or_create_account(self):
        try:
            user, is_authed = AccountService.get_or_create_account(
                self.key.data, self.password.data
            )
            if not user or not is_authed:
                self.key.errors.append("Key or password is incorrect")
        except Error as e:
            self.key.errors.append(e.error)
            return None, False
        return user, is_authed

    @staticmethod
    def login(user):
        login_user(user)
        redirect_next(default=url_for("static.index"))
Ejemplo n.º 13
0
class LoginForm(FlaskForm):
    email = StringField('Email', validators=[InputRequired(), Length(max=30)])
    password = StringField('Password',
                           validators=[InputRequired()],
                           widget=PasswordInput(hide_value=False))
    submit = SubmitField('Login')
Ejemplo n.º 14
0
class RedisForm(FlaskForm):
    """
    Redis Form

    Fields:
        redis_type (string|optional|default: CLUSTER)
        install_redis (string|required|default: Y)
        redis_master_nodes (integer|required_if, install_redis is Y| default: 3| min: 3)
        redis_node_per_master (integer|required_if install_redis is Y| default: 2)
        redis_namespace (string|required_if install_redis is Y| default: gluu-redis-cluster)
        redis_pw (string|required_if install_redis is Y)
        redis_pw_confirm (string|required_if install_redis is Y|equal_to redis_pw)
        redis_url (string|optional|default : redis-cluster.gluu-redis-cluster.svc.cluster.local:6379)
    """
    redis_type = RadioField("Please select redis Type",
                            choices=[("STANDALONE", "STANDALONE"),
                                     ("CLUSTER", "CLUSTER")],
                            default="CLUSTER")
    install_redis = RadioField(
        "Install Redis",
        choices=[("Y", "Yes"), ("N", "No")],
        default="Y",
        description="For the following prompt if placed [N] "
        "the Redis is assumed to be "
        "installed or remotely provisioned",
        validators=[DataRequired()])
    redis_master_nodes = IntegerField(
        "The number of master node. Minimum is 3",
        default=3,
        validators=[RequiredIfFieldEqualTo("install_redis", "Y")],
        render_kw={"min": 3})
    redis_nodes_per_master = IntegerField(
        "The number of nodes per master node",
        default=2,
        validators=[RequiredIfFieldEqualTo("install_redis", "Y")])
    redis_namespace = StringField(
        "Please enter a namespace for Redis cluster",
        default="gluu-redis-cluster",
        validators=[RequiredIfFieldEqualTo("install_redis", "Y")])
    redis_pw = StringField(
        "Redis Password",
        widget=PasswordInput(hide_value=False),
        validators=[RequiredIfFieldEqualTo("install_redis", "N")])
    redis_pw_confirm = StringField(
        "Redis Password Confirmation",
        widget=PasswordInput(hide_value=False),
        validators=[
            RequiredIfFieldEqualTo("install_redis", "N"),
            EqualTo('redis_pw', message='Passwords do not match')
        ])
    redis_url = StringField(
        "Please enter redis URL. If you are deploying redis",
        default="redis-cluster.gluu-redis-cluster.svc.cluster.local:6379",
        description=
        "Redis URL can be : redis-cluster.gluu-redis-cluster.svc.cluster.local:6379 "
        "in a redis deployment Redis URL using AWS ElastiCach "
        "[Configuration Endpoint]: clustercfg.testing-redis.icrbdv.euc1.cache.amazonaws.com:6379"
    )

    def validate_redis_master_nodes(self, field):
        """
        validate field redis_master_nodes, minimum value is 3
        """
        if field.data < 3:
            raise ValidationError("minimum number of master node is 3")
Ejemplo n.º 15
0
class LoginForm(FlaskForm):
    email = StringField(label='Email', validators=[DataRequired(), Email()])
    password = StringField(label='Пароль',
                           widget=PasswordInput(),
                           validators=[DataRequired()])
    remember_me = BooleanField(label='Запомнить меня')
Ejemplo n.º 16
0
class DojoForm(FlaskForm):
    dojo_onion = StringField("Dojo Onion Address")
    dojo_token = StringField("Dojo Authentication Token")
    dojo_apikey = PasswordField("Dojo API Key",
                                widget=PasswordInput(hide_value=False))
    submit = SubmitField("Update")
Ejemplo n.º 17
0
class FormLogins(FlaskForm):
    username = StringField('username', validators=[DataRequired()])
    password = StringField('password', widget=PasswordInput(hide_value=False))
    submit = SubmitField("Submit")
Ejemplo n.º 18
0
class BackendForm(Form):
    """
    Form for the backend entity. Used to edit a backend instance.

    Attributes
    ----------
    id : IntegerField
        ID of backend
    name : StringField
        Name of backend
    url : StringField
        URL of backend
    openapi : StringField
        Core openEO API version of backend
    output : StringField
        Outputfile of the validation of backend
    authurl : StringField
        Authentication URL of backend
    username : StringField
        Authentication Username of backend
    password : StringField
        Authentication Password of backend
    """
    id = IntegerField('Id')
    name = StringField('Name')
    url = StringField('URL')
    openapi = StringField(
        'OpenAPI-URL'
    )  #SelectField('Backend', choices=[('0_3_1', '0.3.1'), ('0_4_0', '0.4.0'), ('0_4_1', '0.4.1')])
    output = StringField('Output')
    version = StringField('Backend-Version')
    authurl = StringField('Authentication URL')
    username = StringField('Authentication Username')
    password = StringField('Authentication Password',
                           widget=PasswordInput(hide_value=False))

    # variables = FieldList(FormField(VariableForm))

    def set_backend(self, backend):
        """
        Sets the form values to the values of an backend instance

        Parameters
        ----------
        backend : Backend
            Source backend instance
        """
        self.name.data = backend.name
        self.url.data = backend.url
        # self.authurl.data = backend.authurl
        self.version.data = backend.version
        self.password.data = backend.password
        self.username.data = backend.username
        self.output.data = backend.output
        self.openapi.data = backend.openapi
        self.id.data = backend.id

    def get_backend(self):
        """
           Get backend instance with the data of the form instance.

           Return
           ----------
           backend : Backend
               Backend instance with values of the form.
        """
        default_output = "result_{}.json".format(self.id.data)
        return Backend(self.id.data,
                       self.name.data,
                       self.url.data,
                       self.openapi.data,
                       output=default_output,
                       username=self.username.data,
                       version=self.version.data,
                       password=self.password.data)
Ejemplo n.º 19
0
class CouchbaseForm(FlaskForm):
    """
    Couchbase Form

    Fields:
        install_couchbase (string|required)
        couchbase_crt (file|required_if install_couchbase is N)
        couchbase_cluster_file_override (string|required|default: N)
        couchbase_cluster_files (file|required_if couchbase_cluster_file_override is Y)
        couchbase_use_low_resource (string|optional|default: N|forced to Y for microk8s and minikube)
        couchbase_namespace (string|required|default: cbns)
        couchbase_cluster_name (string|required|default: cbgluu)
        couchbase_url (string|required|default: cbgluu.cbns.svc.cluster.local)
        couchbase_bucket_prefix (string|required|default: cn)
        couchbase_index_num_replica string|required|default: 0)
        couchbase_user (string|required|default: admin)
        couchbase_password (string|required|default: auto generate)
        couchbase_password_confirmation (string|required|equal to couchbase_password)
        couchbase_cn (string|optional|default: Couchbase CA)

    Note:
        COUCHBASE_CN will be required when couchbase certs inside couchbase_crts-keys folder not exist
    """
    install_couchbase = RadioField(
        "Install Couchbase",
        choices=[("Y", "Yes"), ("N", "No")],
        description="For the following prompt if placed [N] the couchbase "
        "is assumed to be installed or remotely provisioned",
        validators=[DataRequired()])
    package_url = StringField(
        "Couchbase Kubernetes Package URL",
        validators=[
            RequiredIfFieldEqualTo("install_couchbase", "Y"),
            URL(require_tld=False, message="Url format is wrong")
        ],
        description=
        "Please place a downloadable link containing the couchbase linux autonomous operator kubernetes package,"
        "go to <a target='_blank' href='https://www.couchbase.com/downloads'>https://www.couchbase.com/downloads</a>"
    )

    couchbase_crt = FileField(
        "Couchbase certificate",
        description=
        "Place the Couchbase certificate authority certificate in a file called couchbase.crt "
        "This can also be found in your couchbase UI Security > Root Certificate",
        validators=[RequiredIfFieldEqualTo("install_couchbase", "N")])
    couchbase_cluster_file_override = RadioField(
        "Override couchbase-cluster.yaml with a custom couchbase-cluster.yaml",
        choices=[("Y", "Yes"), ("N", "No")],
        validators=[DataRequired()])
    couchbase_cluster_files = MultipleFileField(
        "Couchbase override files",
        description="Please upload the override files under the name "
        "couchbase-cluster.yaml, couchbase-buckets.yaml, "
        "and couchbase-ephemeral-buckets.yaml",
        validators=[
            RequiredIfFieldEqualTo("couchbase_cluster_file_override", "Y")
        ])
    couchbase_use_low_resources = RadioField(
        "Setup CB nodes using low resources for demo purposes",
        choices=[("Y", "Yes"), ("N", "No")])

    couchbase_namespace = StringField(
        "Please enter a namespace for CB objects",
        default="cbns",
        validators=[InputRequired()])
    couchbase_cluster_name = StringField("Please enter a cluster name",
                                         default="cbgluu",
                                         validators=[InputRequired()])
    couchbase_url = StringField(
        "Please enter  couchbase (remote or local) URL base name",
        default="cbgluu.cbns.svc.cluster.local",
        validators=[InputRequired()])

    couchbase_bucket_prefix = StringField(
        "Please enter a  prefix name for all couchbase gluu buckets",
        default="cn",
        validators=[InputRequired()])

    couchbase_index_num_replica = StringField(
        "Please enter the number of replicas per index created.",
        description=
        "Please note that the number of index nodes must be one greater than the number of replicas. "
        "That means if your couchbase cluster only has 2 "
        "index nodes you cannot place the number of replicas to be higher than 1.",
        default=0,
        validators=[InputRequired()])

    couchbase_superuser = StringField(
        "Please enter couchbase superuser username",
        default="admin",
        validators=[InputRequired()])
    couchbase_superuser_password = StringField(
        "Couchbase superuser password",
        widget=PasswordInput(hide_value=False),
        validators=[InputRequired(),
                    password_requirement_check()],
        description="Password is randomly generated with 6 characters contain "
        "number, uppercase letter, lower case letter and symbol")
    couchbase_superuser_password_confirmation = StringField(
        "Couchbase superuser password confirm",
        widget=PasswordInput(hide_value=False),
        validators=[InputRequired(),
                    EqualTo("couchbase_superuser_password")])
    couchbase_user = StringField("Please enter gluu couchbase username",
                                 default="gluu",
                                 validators=[InputRequired()])
    couchbase_password = StringField(
        "Couchbase gluu user password",
        widget=PasswordInput(hide_value=False),
        validators=[InputRequired(),
                    password_requirement_check()],
        description="Password is randomly generated with 6 characters contain "
        "number, uppercase letter, lower case letter and symbol")
    couchbase_password_confirmation = StringField(
        "Couchbase gluu user password confirm",
        widget=PasswordInput(hide_value=False),
        validators=[InputRequired(),
                    EqualTo("couchbase_password")])
    couchbase_cn = StringField("Enter Couchbase certificate common name.",
                               default="Couchbase CA")

    def validate_package_url(self, field):
        """
        validate field package_url, checking pattern
        """
        if "couchbase-autonomous-operator-kubernetes" not in field.data:
            raise ValidationError(
                "The uploaded package is not the Couchbase Autonomous Operator linux package"
            )

        if "_1." in field.data:
            raise ValidationError(
                "The uploaded package must be version 2 or above")
Ejemplo n.º 20
0
class GluuGatewayForm(FlaskForm):
    """
    Gluu Gateway Form

    Fields :
        install_gluu_gateway (string|required|default: N)
        postgres (form field form postgresForm)
        kong_namespace (string|required_if install_gluu_gateway = Y|default: gluu-gateway)
        gluu_gateway_ui_namesapce (string|required_if install_gluu_gateway = Y|default: gg-ui)
        kong_database (string|required_if install_gluu_gateway = Y|default: kong)
        kong_pg_user (string|required_if install_gluu_gateway = Y|default: kong)
        kong_pg_password (string|required_if install_gluu_gateway = Y|default: auto generated)
        kong_pg_password_confirmation (string|required_if install_gluu_gateway = Y|default: auto generated)
        gluu_gateway_ui_database (string|required_if install_gluu_gateway = Y|default: konga)
        gluu_gateway_ui_user (string|required_if install_gluu_gateway = Y|default: konga)
        gluu_gateway_ui_pg_password (string|required_if install_gluu_gateway = Y|default: auto generated)
        gluu_gateway_ui_pg_password_confirmation (string|required_if install_gluu_gateway = Y|default: auto generated)
    """
    install_gluu_gateway = RadioField("Install Gluu Gateway Database mode",
                                      choices=[("Y", "Yes"), ("N", "No")],
                                      default="N",
                                      validators=[DataRequired()])
    postgres = FormField(PostgresForm)
    kong_namespace = StringField(
        "Please enter a namespace for Gluu Gateway",
        default="gluu-gateway",
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y")])
    gluu_gateway_ui_namespace = StringField(
        "Please enter a namespace for gluu gateway ui",
        default="gg-ui",
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y")])
    kong_database = StringField(
        "Please enter gluu-gateway postgres database name",
        default="kong",
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y")])
    kong_pg_user = StringField(
        "Please enter a user for gluu-gateway postgres database",
        default="kong",
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y")])
    kong_pg_password = StringField(
        "Kong Postgress Password",
        widget=PasswordInput(hide_value=False),
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y"),
                    password_requirement_check()],
        description="Password is randomly generated with 6 characters contain "
                    "number, uppercase letter, lower case letter and symbol")
    kong_pg_password_confirm = StringField(
        "Kong Postgress Password Confirmation",
        widget=PasswordInput(hide_value=False),
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y"),
                    EqualTo('kong_pg_password_confirm',
                            message='Passwords do not match')])
    gluu_gateway_ui_database = StringField(
        "Please enter gluu-gateway-ui postgres database name",
        default="konga",
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y")])
    gluu_gateway_ui_pg_user = StringField(
        "Please enter a user for gluu-gateway-ui postgres database",
        default="konga",
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y")])
    gluu_gateway_ui_pg_password = StringField(
        "Gluu Gateway UI postgres password",
        widget=PasswordInput(hide_value=False),
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y"),
                    password_requirement_check()],
        description="Password is randomly generated with 6 characters contain "
                    "number, uppercase letter, lower case letter and symbol")
    gluu_gateway_ui_pg_password_confirm = StringField(
        "Gluu Gateway UI postgres password confirmation",
        widget=PasswordInput(hide_value=False),
        validators=[RequiredIfFieldEqualTo("install_gluu_gateway", "Y"),
                    EqualTo('gluu_gateway_ui_pg_password',
                            message='Passwords do not match')])
Ejemplo n.º 21
0
class Inscription(FlaskForm):
    user = StringField('Nom utilisateur ', validators=[DataRequired(), Length(min=3, max=20)])
    password = StringField('Mot de passe ', validators=[DataRequired()], widget=PasswordInput(hide_value=True))
    pass
Ejemplo n.º 22
0
 def __init__(self, *args, **kwargs):
   self.autocomplete = kwargs.pop('autocomplete', None)
   BasePasswordInput.__init__(self, *args, **kwargs)
Ejemplo n.º 23
0
class AdminRegistration(FlaskForm):
    firstname = StringField('FirstName',
                            validators=[DataRequired(),
                                        Length(min=1, max=15)])
    lastname = StringField('LastName',
                           validators=[DataRequired(),
                                       Length(min=1, max=20)])
    middleinitial = StringField('M.I', validators=[Optional(), Length(max=1)])
    iam = SelectField('Register for...',
                      choices=[('', ''), ('DR', 'Doctor'), ('ST', 'Staff')],
                      validators=[DataRequired(),
                                  Length(min=1)])

    dob = DateField('Date of Birth',
                    validators=[DataRequired()],
                    format='%Y-%m-%d')

    streetnumber = IntegerField('Street Number', validators=[DataRequired()])
    streetname = StringField(
        'Street Name', validators=[DataRequired(),
                                   Length(min=1, max=35)])
    aptnumber = IntegerField('Apt-Number',
                             validators=[Optional()],
                             default=None)
    city = StringField('City',
                       validators=[DataRequired(),
                                   Length(min=1, max=20)])
    statename = SelectField('State',
                            choices=[('AL', 'Alabama'), ('AK', 'Alaska'),
                                     ('AZ', 'Arizona'), ('AR', 'Arkansas'),
                                     ('CA', 'California'), ('CO', 'Colorado'),
                                     ('CT', 'Connecticut'), ('DE', 'Delaware'),
                                     ('DC', 'District Of Columbia'),
                                     ('FL', 'Florida'), ('GA', 'Georgia'),
                                     ('HI', 'Hawaii'), ('ID', 'Idaho'),
                                     ('IL', 'Illinois'), ('IN', 'Indiana'),
                                     ('IA', 'Iowa'), ('KS', 'Kansas'),
                                     ('KY', 'Kentucky'), ('LA', 'Louisiana'),
                                     ('ME', 'Maine'), ('MD', 'Maryland'),
                                     ('MA', 'Massachusetts'),
                                     ('MI', 'Michigan'), ('MN', 'Minnesota'),
                                     ('MS', 'Mississippi'), ('MO', 'Missouri'),
                                     ('MT', 'Montana'), ('NE', 'Nebraska'),
                                     ('NV', 'Nevada'), ('NH', 'New Hampshire'),
                                     ('NJ', 'New Jersey'),
                                     ('NM', 'New Mexico'), ('NY', 'New York'),
                                     ('NC', 'North Carolina'),
                                     ('ND', 'North Dakota'), ('OH', 'Ohio'),
                                     ('OK', 'Oklahoma'), ('OR', 'Oregon'),
                                     ('PA', 'Pennsylvania'),
                                     ('PR', 'Puerto Rico'),
                                     ('RI', 'Rhode Island'),
                                     ('SC', 'South Carolina'),
                                     ('SD', 'South Dakota'),
                                     ('TN', 'Tennessee'), ('TX', 'Texas'),
                                     ('UT', 'Utah'), ('VT', 'Vermont'),
                                     ('VA', 'Virginia'), ('WA', 'Washington'),
                                     ('WV', 'West Virginia'),
                                     ('WI', 'Wisconsin'), ('WY', 'Wyoming')],
                            validators=[DataRequired()])

    zipcode = IntegerField('Zip code', validators=[DataRequired()])
    phonenumber = StringField(
        'Phone Number',
        validators=[DataRequired(), Length(min=10, max=10)],
        render_kw={"placeholder": "1234567890"})
    sex = SelectField('Sex',
                      choices=[('', ''), ('male', 'Male'),
                               ('female', 'Female')],
                      validators=[DataRequired(),
                                  Length(min=1)])
    ethnicity = SelectField('Ethnicity',
                            choices=[('', ''), ('W', 'White'),
                                     ('AA', 'African American'),
                                     ('AI', 'Asian'),
                                     ('NA', 'Native American'),
                                     ('PI', 'Pacific Islander'),
                                     ('HI', 'Hispanic'), ('OT', 'Others')],
                            validators=[DataRequired(),
                                        Length(min=1)])

    username = StringField('UserName',
                           validators=[DataRequired(),
                                       Length(min=4, max=20)])
    email = StringField('Email',
                        validators=[DataRequired(),
                                    Email(),
                                    Length(max=30)])
    password = StringField('Password',
                           validators=[DataRequired(),
                                       Length(min=6, max=20)],
                           widget=PasswordInput(hide_value=False))

    cpassword = PasswordField('Confirm Password',
                              validators=[
                                  DataRequired(),
                                  Length(min=6, max=20),
                                  EqualTo('password')
                              ],
                              widget=PasswordInput(hide_value=False))

    submit = SubmitField('Sign Up')
Ejemplo n.º 24
0
 'name': {
     'validators': [DataRequired()],
     'description': {
         'placeholder': "Name",
     }
 },
 'ip': {
     'validators':
     [DataRequired(),
      IPAddress(message="Invalid IP Address")],
     'description': {
         'placeholder': "IP"
     }
 },
 'password': {
     'widget': PasswordInput(),
     'validators': [DataRequired()],
     'description': {
         'placeholder': "Password",
     }
 },
 'devicetype': {
     'validators': [DataRequired()],
     'description': {
         'label': DeviceType.friendly_name,
     }
 },
 'lan': {
     'validators': [DataRequired()],
     'description': {
         'label': Lan.friendly_name,
Ejemplo n.º 25
0
class RegistraceForm(FlaskForm):
    jmeno = StringField("jmeno", validators=[DataRequired()])
    heslo = StringField("heslo", validators=[DataRequired()], widget=PasswordInput(hide_value=False))
    heslo_znovu = StringField("heslo_znovu", validators=[DataRequired()], widget=PasswordInput(hide_value=False))
    obrazek = StringField("obrazek")
Ejemplo n.º 26
0
class PrihlaseniForm(FlaskForm):
    jmeno = StringField("jmeno", validators=[DataRequired()])
    heslo = StringField("heslo", validators=[DataRequired()], widget=PasswordInput(hide_value=False))
Ejemplo n.º 27
0
class ConfigurationForm(FlaskForm):
    """
    Config Form

    Fields:
        gluu_fqdn (string|required|default: demoexample.gluu.org)
        country_code (string|required|default: US)
        state (string|required|default: TX)
        city (string|required|default: Austin)
        email (string|required|default: [email protected])
        org_name (string|required|default: Gluu)
        admin_pw (string|required|default: auto generated)
        admin_pw_confirm (string|required, equal to admin_pw)
        ldap_pw (string|optional, required for hybrid and ldap backend)
        ldap_pw_confirm (string|equal to ldap_pw)
        is_gluu_fqdn_registered (string|optional)

    TODO: find a better way to override ldap_pw validators
    """
    gluu_fqdn = StringField("Hostname",
                            default="demoexample.gluu.org",
                            validators=[InputRequired()])
    country_code = StringField("Country Code",
                               default="US",
                               validators=[InputRequired()])
    state = StringField("State", default="TX", validators=[InputRequired()])
    city = StringField("City", default="Austin", validators=[InputRequired()])
    email = StringField("Email",
                        default="*****@*****.**",
                        validators=[Email()])
    org_name = StringField("Organization",
                           default="Gluu",
                           validators=[InputRequired()])
    admin_pw = StringField(
        "oxTrust Password",
        widget=PasswordInput(hide_value=False),
        validators=[InputRequired(),
                    password_requirement_check()],
        description="Password is randomly generated with 6 characters contain "
        "number, uppercase letter, lower case letter and symbol")
    admin_pw_confirm = StringField("oxTrust Password Confirm",
                                   widget=PasswordInput(hide_value=False),
                                   validators=[EqualTo("admin_pw")])
    ldap_pw = StringField(
        "LDAP Password",
        widget=PasswordInput(hide_value=False),
        description="Password is randomly generated with 6 characters contain "
        "number, uppercase letter, lower case letter and symbol")
    ldap_pw_confirm = StringField("LDAP Password Confirm",
                                  widget=PasswordInput(hide_value=False),
                                  validators=[EqualTo("ldap_pw")])
    is_gluu_fqdn_registered = RadioField(
        "Are you using a globally resolvable FQDN",
        choices=[("Y", "Yes"), ("N", "No")],
        description="You can mount your FQDN certification and key by placing "
        "them inside gluu.crt and gluu.key respectivley "
        "at the same location pygluu-kubernetes.pyz is at.",
        render_kw={"disabled": "disabled"})

    def validate_gluu_fqdn(self, field):
        """
        FQDN validation format
        """
        regex_bool = re.match(
            r'^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.){2,}([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]){2,}$',
            self.gluu_fqdn.data)

        if not regex_bool:
            raise ValidationError(
                "Input not FQDN structured. Please enter a FQDN with the format demoexample.gluu.org"
            )
Ejemplo n.º 28
0
 def __call__(self, field, **kwargs):
   kwargs.setdefault('autocomplete', self.autocomplete)
   return BasePasswordInput.__call__(self, field, **kwargs)
Ejemplo n.º 29
0
class LoginForm(FlaskForm):
    email = StringField("Email", validators=[DataRequired()])
    password = StringField("Password", widget=PasswordInput(hide_value=False), validators=[DataRequired()])
    submit_button = SubmitField("Submit")
Ejemplo n.º 30
0
class form_login(FlaskForm):
    email = StringField('E-mail',
                        validators=[DataRequired("Campo obrigatório")])
    senha = StringField('Senha',
                        validators=[DataRequired("Campo obrigatório!")],
                        widget=PasswordInput(hide_value=False))
Ejemplo n.º 31
0
class LoginForm(FlaskForm):
    username = StringField('UserName', [DataRequired("Enter your name")])
    password = PasswordField('Password', [DataRequired("Enter your password")],
                             widget=PasswordInput(hide_value=False))
Ejemplo n.º 32
0
class LoginForm(Form):
    username = StringField('username', validators=[DataRequired()])
    password = StringField('password',
                           validators=[DataRequired()],
                           widget=PasswordInput())