Modify

Opened 12 months ago

Closed 2 months ago

#12985 closed defect (worksforme)

Enabling 'UsernamePermCheck' duplicates additional required fields

Reported by: ntmlod Owned by: Ryan J Ollos
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I have coded a textarea field and a checkbox input in addition of the default required fields in the registration form. After I encountered the bug with all checks on, I tested each one by one and it happens only with acct_mgr.register.usernamepermcheck = enabled

Attachments (0)

Change History (5)

comment:1 Changed 12 months ago by ntmlod

I forgot the version of the plugin (tags 0.4.4) and the revision r13806

comment:2 Changed 12 months ago by ntmlod

I've just made a simple test by replacing the 6 lines in trac.ini by acct_mgr.register.* = enabled and I get 3 copies of my supplemental fields.

comment:3 Changed 7 months ago by ntmlod

Well I think I solved my problem but not sure if it's the clever solution.

I have developed customized required fields for registration in the generic class GenericRegistrationInspector inside render_registration_fields but with the loop in process_request under RegistrationModule

      # Collect additional fields from IAccountRegistrationInspector's.
        fragments = dict(required=[], optional=[])
        for inspector in acctmgr.register_checks:
            try:
                fragment, f_data = inspector.render_registration_fields(req,
                                                                        data)

My customized fields are duplicated twice in register.html with RegExpCheck and UsernamePermCheck inspectors even if they have no particular fields to add due to inheritance with GenericRegistrationInspector class

I fixed by adding a !void render_registration_fields in each involved class

    def render_registration_fields(self, req, data):
        template = ''
        return template, data

Simply escape these cases in the loop seems to be another possibility.

Or perhaps I did not understand anything as my customized required fields would have been created in a different way.

comment:4 Changed 2 months ago by Ryan J Ollos

In 16844:

TracAccountManager 0.5dev: Eliminate GenericRegistrationInspector class

The class was mostly useless as it does little more than replicate
the Interface definition.

Refs #12985.

comment:5 Changed 2 months ago by Ryan J Ollos

Resolution: worksforme
Status: newclosed

I think there is probably an issue with how you implemented your IAccountRegistrationInspector. Try implementing the interface directly rather than inheriting from GenericRegistrationInspector. Make sure you are running the latest TracAccountManager 0.5dev.

Please share the code for your custom IAccountRegistrationInspector plugin, and your [account-manager] register_check value from trac.ini.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.