<![CDATA[ Create required fields in manager login. - My Forums]]> https://forums.modx.com/thread/?thread=103980 <![CDATA[Create required fields in manager login.]]> https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559214
I was wondering if it’s possible to create a required field in manager login.
I need this to create 2 checkbox for the privacy policy (GDPR).



Thanks for the help.]]>
erdemozy Jun 25, 2018, 12:29 PM https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559214
<![CDATA[Re: Create required fields in manager login.]]> https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559249
[update] Another thought, you could attach a new plugin (or use the same one with a switch statment) to OnManagerAuthentication or OnManagerLogin and check to see if the checkbox variables are set.



]]>
BobRay Jun 26, 2018, 06:53 PM https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559249
<![CDATA[Re: Create required fields in manager login.]]> https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559228
Thanks for your help.

I have used the plugin. It's working very wel.

But can i make them also required field? (not with html 5)

This is the code for the plugin and i am using "OnManagerLoginFormRender".
<?php
/* Plugin attached to one of those events */
 
$extraFields = '
        <div class="x-form-check-wrap modx-login-rm-cb">
            <div class="x-form-item login-form-item">
                <input type="checkbox" id="privacybeleid" name="privacybeleid" class="x-form-checkbox x-form-field" aria-required="true" required />
                <label for="privacybeleid" class="x-form-cb-label">Ik ga akkoord met de privacybeleid.</label>
            </div>
        </div>
        <div class="x-form-check-wrap modx-login-rm-cb">
            <div class="x-form-item login-form-item">
                <input type="checkbox" id="cookiebeleid" name="cookiebeleid" class="x-form-checkbox x-form-field" aria-required="true" required />
                <label for="cookiebeleid" class="x-form-cb-label">Ik ga akkoord met de cookiebeleid.</label>
            </div>
        </div>
';
 
$modx->event->_output = $extraFields;
return;
]]>
erdemozy Jun 26, 2018, 06:52 AM https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559228
<![CDATA[Re: Create required fields in manager login.]]> https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559224
manager/templates/default/security/login.tpl


Make a copy so you can redo your changes when you upgrade MODX.

A more complicated method that will survive upgrades is to return the extra HTML code from either:

OnManagerLoginFormPrerender
or
OnManagerLoginFormRender

IIRC, that goes something like this:

<?php
/* Plugin attached to one of those events */

$extraFields = '
   <input type="checkbox" etc.>
   <input type="checkbox" etc.>
';

$modx->event->_output = $extraFields;
return;


See the Tpl chunk for the format and classes (look for the remember me checkbox).

If that doesn't work try:

$modx->event->output = $extraFields;

or

return $extraFields;


Let me know if you use the plugin and what version worked.

]]>
BobRay Jun 25, 2018, 11:41 PM https://forums.modx.com/thread/103980/create-required-fields-in-manager-login#dis-post-559224