Source code for hawat.blueprints.auth_dev.forms

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# This file is part of Mentat system (https://mentat.cesnet.cz/).
#
# Copyright (C) since 2011 CESNET, z.s.p.o (http://www.ces.net/)
# Use of this source is governed by the MIT license, see LICENSE file.
#-------------------------------------------------------------------------------


"""
This module contains custom developer login form for Hawat.
"""


__author__ = "Jan Mach <jan.mach@cesnet.cz>"
__credits__ = "Pavel Kácha <pavel.kacha@cesnet.cz>, Andrea Kropáčová <andrea.kropacova@cesnet.cz>"


import wtforms
from wtforms.ext.sqlalchemy.fields import QuerySelectMultipleField
from flask_babel import lazy_gettext

from vial.forms import check_login, check_unique_login, get_available_groups

from hawat.blueprints.users.forms import BaseUserAccountForm


[docs]class RegisterUserAccountForm(BaseUserAccountForm): """ Class representing user account registration form. """ login = wtforms.StringField( lazy_gettext('Login:'), validators = [ wtforms.validators.DataRequired(), wtforms.validators.Length(min = 3, max = 50), check_login, check_unique_login ] ) memberships_wanted = QuerySelectMultipleField( lazy_gettext('Requested group memberships:'), query_factory = get_available_groups ) justification = wtforms.TextAreaField( lazy_gettext('Justification:'), validators = [ wtforms.validators.DataRequired(), wtforms.validators.Length(min = 10, max = 500) ] )