didhavn

Bug in FieldtypePassword

3 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By modifiedcontent
      I have a simple front-end password update form like this:
      In the browser the label of the second field shows up as follows:
      WTH?!
      I can't figure out what is changing the label, what is inserting /processwire/ and reformatting the thing. Is this something in PW? A "helpful" thing that browsers do?
      Edit:
      The problem disappears if I simply rename the second field to 'Confirm Password'.
      So my problem is solved, but I'll leave this here in case this is some kind of bug.
    • By modifiedcontent
      How do you get the same 'set password' form/input fields on the front-end as in the admin area?
      I have a working front-end version, but the admin version has some nifty stuff around it. Should be easy to get the same on the front-end, right?
    • By CarloC
      Hi everyone!
      this is my first topic and I need to say thanks to @ryan and all the other contributors for this incredible framework that changed my life as a web dev!
      But now I go to the point. I developed a project with pw 2.7 and it worked like a charm.
      Today i'm trying to update the project to pw3 on a local environment, to test that everything will continue working after the upgrade, and that's not the case.
      The major bug I'm encountering is that repeater field doesn't work properly.
      Existing Repeater field
      This is what I see when I try to edit a page that already has a repeater field (Brand concepts) with some elements:

      If I click on one of the "... blocks" nothing appens.
      New repeater field
      If I create a new repeater field and assing it to a template, when I open a page with that template I see the new repeater field, but the "Add new" link, to add a new element, doesn't work. I click it and nothing appens.

      I never had this kind of strange behaviours in PW, and this is one of the reasons why I consider it the best cms/framework I've ever used.
      I hope you can help me.
      Thank you!
    • By Doc
      Hello,
      Newbie question here.
      I'm rebuilding my existing website with PW, it's a game where people can guess the winners of races.
      I used to have a "players" table. Those are registered players, I used to identify them through their login/password, and when it matches, I give them access to the website. No rocket science.
      So now with PW, I'm building my sign-up form and I'm trying to create a new session when a new user sign up.
      I'm retrieving user/pass from the sign-up form which has been posted before but :
      if($session->login($user, $pass)) {
          // login successful
          $session->redirect(elsewhere);
      }
      else
          echo "failed";
      ... fails everytime.
      Do I have to use something like :
      $u = new User(); $u->name = "bill"; $u->pass = "billpwd"; $u->addRole("guest"); $u->save(); ... before doing a session->login('bill', 'billpwd') ?? (I've just checked, it works, so I guess this is the good way to do it ?)
      I already have my players table so perhaps I can have the minimum in the PW's table and keep my players info in my historical table ?
      ... Or I can add all information I need into PW but I'd like to understand where it is stored.
      Last question, if there is a PW matching between "user" and "session", I need to give to the session->login function the password not hashed. I'm using the password_hash php function, any problem with that ?
      Thanks
       
       
    • By Richard Jedlička
      PDF Fieldtype/Inputfield
       
      Module for ProcessWire allowing you to easily generate thumbnails of the PDF files embedded to the site.
       
      Current version: 1.1.2 (Changelog)

      Module page: http://modules.processwire.com/modules/fieldtype-pdf
      Github: https://github.com/uiii/ProcessWire-FieldtypePDF
      For detailed instructions see: https://github.com/uiii/ProcessWire-FieldtypePDF/blob/master/README.md