Jump to content

Bug in FieldtypePassword


didhavn
 Share

Recommended Posts

Hey all.

I just came across a potential error in the FieldtypePassword.

I have a password field added to some templates to protect the pages. However, whenever I want to save a page, I get the error of "required fiield missing"...that the password field is required and missing. But, the field is not set to required.

Can anybody confirm that and/or has a solution?

Best, Lukas

pwpass_requirederror.jpg

Link to comment
Share on other sites

I think password fields are required regardless of whether the "required" checkbox is checked or not. You'll notice that the system "pass" field doesn't have required checked.

You should be able to get around this though with this in your admin.php

$this->wire()->addHookBefore('InputfieldPassword::processInput', null, function($event) {
    $event->object->required = false;
});

You will probably want to limit it to your custom password field though, rather than all password fields.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...