예제 #1
0
파일: users.py 프로젝트: z0x010/mediadrop
class UserForm(ListForm):
    template = 'admin/box-form.html'
    id = 'user-form'
    css_class = 'form'
    submit_text = None
    show_children_errors = True
    _name = 'user-form' # TODO: Figure out why this is required??
    
    event = events.Admin.UserForm
    
    fields = [
        TextField('display_name', label_text=N_('Display Name'), validator=TextField.validator(not_empty=True), maxlength=255),
        TextField('email_address', label_text=N_('Email Address'), validator=email_validator(not_empty=True), maxlength=255),
        ListFieldSet('login_details', suppress_label=True, legend=N_('Login Details:'),
            css_classes=['details_fieldset'],
            validator = Schema(chained_validators=[
                FieldsMatch('password', 'confirm_password',
                messages={'invalidNoMatch': N_("Passwords do not match"),})]
            ),
            children=[
                CheckBoxList('groups', label_text=N_('Groups'), 
                    options=lambda: Group.custom_groups(Group.group_id, Group.display_name).all()),
                TextField('user_name', label_text=N_('Username'), maxlength=16, validator=All(PlainText(), UniqueUsername(not_empty=True))),
                PasswordField('password', label_text=N_('Password'), validators=NotEmpty, maxlength=80, attrs={'autocomplete': 'off'}),
                PasswordField('confirm_password', label_text=N_('Confirm password'), validators=NotEmpty, maxlength=80, attrs={'autocomplete': 'off'}),
            ]
        ),
        SubmitButton('save', default=N_('Save'), named_button=True, css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
        SubmitButton('delete', default=N_('Delete'), named_button=True, css_classes=['btn', 'btn-delete']),
    ]
예제 #2
0
 class EditForm(EditableForm):
     __entity__ = self.model
     __require_fields__ = [user_name_field, email_field]
     __omit_fields__ = ['created', '_password']
     __hidden_fields__ = [user_id_field]
     __field_order__ = [
         user_id_field, user_name_field, email_field,
         display_name_field, 'password', 'verify_password', 'groups'
     ]
     password = PasswordField('password', value='')
     verify_password = PasswordField('verify_password')
     __base_validator__ = edit_form_validator
예제 #3
0
class LoginForm(ListForm):
    template = 'forms/box_form.html'
    method = 'POST'
    id = 'login-form'
    css_class = 'form clearfix'
    submit_text = None
    # For login failures we display only a generic (bad username or password) 
    # error message which is not related to any particular field. 
    # However I'd like to mark the input widgets as faulty without displaying 
    # the dummy errors (injected by LoginController programmatically as this 
    # form is not used for credential validation) so this will prevent the error
    # text from being displayed. However the actual input fields will be marked
    # with css classes anyway.
    show_children_errors = False

    fields = [
        TextField('login', label_text=N_('Username'), 
            # 'autofocus' is actually not XHTML-compliant
            attrs={'autofocus': True}),
        PasswordField('password', label_text=N_('Password')),
        
        SubmitButton('login_button', default=N_('Login'), 
            css_classes=['mcore-btn', 'btn-submit', 'f-rgt'])
    ]

    def post_init(self, *args, **kwargs):
        events.LoginForm(self)
    class fields(WidgetsList):
        nombres = TextField(validator=NotEmpty)
	apellidos = TextField(validator=NotEmpty)
	username = TextField(validator=NotEmpty)
	password = PasswordField(validator=NotEmpty)
        #fecha_creacion = CalendarDatePicker(validator=DateConverter())
        submit_tex = "Crear Usuario"
예제 #5
0
class UsuarioForm(TableForm):

    hover_help = True
    show_errors = True

    fields = [
        HiddenField('id_usuario', label_text='Id',
            help_text='Id del usuario'),
        TextField('nombre', validator=NotEmpty_Text, label_text='Nombre', size=38,
            help_text='Introduzca su nombre completo.'),
        Spacer(),
        TextField('apellido', validator=NotEmpty_Text, label_text='Apellido', size=38,
            help_text='Introduzca su apellido completo.'),
        Spacer(),
        TextField('nombre_usuario', validator=UniqueUsername, label_text='Nombre de usuario', size=38,
            help_text='Introduzca un nombre de usuario para el login.'),
        Spacer(),
        PasswordField('password', validator=NotEmpty, label_text='Password', size=38,
            help_text='Introduzca su password.'),
        Spacer(),
        TextField('direccion', validator=MiPlainText, label_text='Direccion', size=38,
            help_text='Introduzca su direccion de domicilio.'),
        Spacer(),
        TextField('telefono', validator=NumerosTelefono, label_text='Telefono', size=38,
            help_text='Introduzca un numero de telefono.'),
        Spacer(),
        TextField('email', validator=Email, label_text='E-mail', size=38,
            help_text='Introduzca un nombre de e-mail.'),
        Spacer()]

    submit_text = 'Guardar Usuario'
예제 #6
0
class AddUsuarioForm(TableForm):

    fields = [
        TextField('nombres', label_text='Nombres'),
        TextField('apellidos', label_text='Apellidos'),
        TextField('username', label_text='Username'),
        PasswordField('password', label_text='Contrasenha')
    ]

    submit_text = 'Guardar Usuario'
예제 #7
0
class RegistrationForm(AddRecordForm):
    __model__ = User
    __require_fields__ = ['password', 'user_name', 'email_address']
    __omit_fields__ = ['_password']
    __field_order__ = [
        'user_name', 'email_address', 'display_name', 'password',
        'verify_password'
    ]
    __base_validator__ = form_validator
    email_address = TextField
    display_name = TextField
    verify_password = PasswordField('verify_password')
예제 #8
0
class User_EditForm(EditableForm):
    __entity__ = User
    __omit_fields__ = ['_password', 'created', 'user_id', 'town_id']
    __require_fields__ = ['user_name', 'email_address', 'password']
    __field_order__ = [
        'user_name', 'email_address', 'display_name', 'password',
        'verify_password', 'groups'
    ]
    __limit_fields__ = ['user_name']
    __base_validator__ = form_validator
    email_address = TextField
    verify_password = PasswordField('verify_password')
예제 #9
0
class UserForm(AddRecordForm):
    __model__ = User
    __omit_fields__ = ['_password', 'created', 'user_id', 'town_id']
    __require_fields__ = ['user_name', 'email_address', 'password']
    __field_order__ = [
        'user_name', 'email_address', 'display_name', 'password',
        'verify_password', 'groups'
    ]
    __limit_fields__ = ['user_name']
    __base_validator__ = form_validator
    email_address = TextField
    display_name = TextField('descripcion')
    verify_password = PasswordField('verify_password')
예제 #10
0
 class fields(WidgetsList):
     came_from = HiddenField()
     logins = HiddenField()
     login = TextField(label_text=l_('User Name'))
     password = PasswordField(label_text=l_('Password'))