def __init__(self, view, account_management_interface): self.account_management_interface = account_management_interface super().__init__(view, 'choose_password') if self.exception: self.add_child( Alert(view, self.exception.as_user_message(), 'warning')) inputs = self.add_child( FieldSet(view, legend_text=_('Choose a new password'))).use_layout( FormLayout()) inputs.layout.add_input( TextInput(self, account_management_interface.fields.email)) inputs.layout.add_input( TextInput(self, account_management_interface.fields.secret)) inputs.layout.add_input( PasswordInput(self, account_management_interface.fields.password)) inputs.layout.add_input( PasswordInput(self, account_management_interface.fields.repeat_password)) actions = self.add_child(ActionButtonGroup(view)) btn = actions.add_child( Button(self, account_management_interface.events.choose_password_event)) btn.use_layout(ButtonLayout(style='primary'))
def __init__(self, view, event_channel_name, account_management_interface): self.account_management_interface = account_management_interface super().__init__(view, event_channel_name) if self.exception: self.add_child( Alert(view, self.exception.as_user_message(), 'warning')) identification_inputs = self.add_child( FieldSet(view, legend_text=_( 'Please supply the following details'))).use_layout( FormLayout()) identification_inputs.layout.add_input( TextInput(self, account_management_interface.fields.email)) identification_inputs.layout.add_input( TextInput(self, account_management_interface.fields.secret)) identification_inputs.layout.add_input( PasswordInput(self, account_management_interface.fields.password)) actions = self.add_child(ActionButtonGroup(view)) btn = actions.add_child( Button(self, account_management_interface.events.verify_event)) btn.use_layout(ButtonLayout(style='primary'))
def create_identification_inputs(self): identification_inputs = self.add_child(FieldSet(self.view, legend_text=_('How will you identify yourself?'))).use_layout(FormLayout()) email_cue = P(self.view, _('You identify yourself to us by your email address.' \ 'This information is not divulged to others.')) error_message=_('Sorry, you can only register once per email address and someone is ' \ 'already registered as $value. Did you perhaps register long ago?') unique_email_field = self.account_management_interface.fields.email.as_with_validation_constraint(UniqueEmailConstraint(error_message)) identification_inputs.layout.add_input(CueInput(TextInput(self, unique_email_field), email_cue)) password_cue = P(self.view, _('Upon logging in, you will be asked for your password. Your password should be a '\ 'secret, known only to yourself, and be difficult to guess.') ) identification_inputs.layout.add_input(CueInput(PasswordInput(self, self.account_management_interface.fields.password), password_cue)) repeat_password_cue = P(self.view, _('By typing the same password again you help us to make sure you did not make any typing mistakes.')) identification_inputs.layout.add_input(CueInput(PasswordInput(self, self.account_management_interface.fields.repeat_password), repeat_password_cue))
def __init__(self, view, accounts): super().__init__(view, 'login') self.use_layout(FormLayout()) if self.exception: self.layout.add_alert_for_domain_exception(self.exception) self.layout.add_input(TextInput(self, accounts.fields.email)) self.layout.add_input(PasswordInput(self, accounts.fields.password)) self.define_event_handler(accounts.events.login_event) self.add_child(Button(self, accounts.events.login_event, style='primary'))
def __init__(self, view, accounts): super(LoginForm, self).__init__(view, 'login') self.use_layout(FormLayout()) if self.exception: self.add_child(Alert(view, self.exception.as_user_message(), 'warning')) self.layout.add_input(TextInput(self, accounts.fields.email)) self.layout.add_input(PasswordInput(self, accounts.fields.password)) self.define_event_handler(accounts.events.login_event) btn = self.add_child(Button(self, accounts.events.login_event)) btn.use_layout(ButtonLayout(style='primary'))
def __init__(self, view, login_session): super().__init__(view, 'login') self.use_layout(FormLayout()) if self.exception: self.add_child( Alert(view, self.exception.as_user_message(), 'warning')) self.layout.add_input( TextInput(self, login_session.fields.email_address)) self.layout.add_input( PasswordInput(self, login_session.fields.password)) self.define_event_handler(login_session.events.log_in) btn = self.add_child(Button(self, login_session.events.log_in)) btn.use_layout(ButtonLayout(style='primary'))
def __init__(self, view, event_channel_name, account_management_interface): super().__init__(view, event_channel_name) self.account_management_interface = account_management_interface if self.exception: self.add_child( Alert(view, self.exception.as_user_message(), 'warning')) login_inputs = self.add_child( FieldSet(view, legend_text=_('Please specify'))).use_layout(FormLayout()) email_cue = P(view, _('The email address you used to register here.')) login_inputs.layout.add_input( CueInput( TextInput(self, self.account_management_interface.fields.email), email_cue)) password_cue = P( view, _('The secret password you supplied upon registration.')) password_cue_input = CueInput( PasswordInput(self, self.account_management_interface.fields.password), password_cue) forgot_password_bookmark = self.user_interface.get_bookmark( relative_path='/resetPassword', description=_('Forgot your password?')) password_cue_input.add_child( A.from_bookmark(view, forgot_password_bookmark)) login_inputs.layout.add_input(password_cue_input) stay_cue = P(view, _('If selected, you will stay logged in for longer.')) login_inputs.layout.add_input( CueInput( CheckboxInput( self, self.account_management_interface.fields.stay_logged_in), stay_cue)) login_buttons = self.add_child(ActionButtonGroup(view)) btn = login_buttons.add_child( Button(self, account_management_interface.events.login_event, style='primary'))
def __init__(self, view, event_channel_name): super().__init__(view, event_channel_name) self.use_layout(FormLayout()) model_object = ModelObject() self.layout.add_input( TextInput(self, model_object.fields.text_input_field)) self.layout.add_input( CheckboxInput(self, model_object.fields.boolean_field)) self.layout.add_input( PasswordInput(self, model_object.fields.password_field)) self.layout.add_input( TextArea(self, model_object.fields.text_area_field, rows=5, columns=60)) self.layout.add_input( SelectInput(self, model_object.fields.choice_field)) self.layout.add_input( SelectInput(self, model_object.fields.multi_choice_field)) self.layout.add_input( CheckboxInput(self, model_object.fields.another_multi_choice_field)) self.layout.add_input( RadioButtonSelectInput(self, model_object.fields.radio_choice_field, contents_layout=ChoicesLayout(inline=True))) self.layout.add_input( TextInput(self, model_object.fields.fuzzy_date_field, fuzzy=True)) self.layout.add_input(TextInput( self, model_object.fields.text_input_without_label, placeholder=True), hide_label=True) self.layout.add_input( CueInput(TextInput(self, model_object.fields.cue_field), P(view, text='This is a cue'))) self.define_event_handler(model_object.events.do_something) self.add_child( ButtonInput(self, model_object.events.do_something, style='primary'))