Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update a user, client validation issue #409

Closed
twig2let opened this issue May 26, 2018 · 5 comments
Closed

Can't update a user, client validation issue #409

twig2let opened this issue May 26, 2018 · 5 comments

Comments

@twig2let
Copy link

twig2let commented May 26, 2018

Brand new install v2.0.0.

Attempt to edit a user, http://0.0.0.0:3000/admin/users/1/edit

On save validation script throws exception: Uncaught TypeError: Cannot read property 'allow_blank' of undefined

The Password input data-validate tag contains JSON, so the Judge.ValidationQueue method fails.

data-validate="["{"kind":"length","options":{"minimum":8,"allow_blank":true},"messages":{"too_short":"is too short (minimum is 8 characters)"}}"]"

It appears to be the only input whose data-validate that isn't an Object.

Have I overlooked something?

Rails 5.0.7
ruby 2.5.1p57
Fae 2.0.0

@jamesmk
Copy link
Member

jamesmk commented Jun 11, 2018

Thanks for the report @twig2let. I am able to recreate the issue and will look into this week.

@jamesmk
Copy link
Member

jamesmk commented Jul 2, 2018

Sorry for the delay. It appears the data-validate attribute is coming back from Judge (Fae's FE validation dependency: https://github.com/joecorcoran/judge) malformed on password inputs. Resolving bugs in dependencies can take a little more time as we'll have to wait for an official release of the Judge gem, then update the gemspec with the new version.

I'm working on a Fae CMS this week and will use the opportunity to look into more. If nothing else, I may submit a workaround until this is fixed in Judge.

thanks

@mbajur
Copy link

mbajur commented Jul 4, 2018

Any dirty-hack to temporary fix this? :)

@jclemans
Copy link
Contributor

jclemans commented Jul 6, 2018

@mbajur - a quick hack I just used was to disable JS in my browser, make the edit to my account, then turn JS back on. You could also add a little JS snippet to remove that data-validate attr.

@jamesmk
Copy link
Member

jamesmk commented Jul 6, 2018

Piggy backing off of what @jclemans was saying, here's some JS you can add to fae.js to disable JS validation on password fields:

$(function() {
  $('input.password').data('validate', '');
});

The Rails validations will still be in place (> 8 chars and matching confirmation), they just won't happen via JS.

aleksb added a commit to aleksb/fae that referenced this issue Sep 11, 2018
aleksb added a commit to aleksb/fae that referenced this issue Sep 11, 2018
jamesmk added a commit that referenced this issue Nov 2, 2018
Issue #409 - fix bugs in stripValidation()
@jamesmk jamesmk closed this as completed Apr 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants