cloudscribe / cloudscribe

ASP.NET Core multi-tenant web application foundation with management for sites, users, roles, claims and more
Other
1.31k stars 280 forks source link

After a validation error, Register button doesn't work first time #719

Open CrispinF opened 4 years ago

CrispinF commented 4 years ago

Attempt registration but fail some validation (e.g. weak password) > adjust the values > Register > it gets stuck at this: image ("Invalid registration attempt" was the validation failure message I saw before the retry). Clicking the button that now says "Working..." completes the post. Tested in Firefox and Chrome.

SimonAnnetts commented 4 years ago

Problem somewhere in the jquery validation submitonce. In src/cloudscribe.Core.CompiledViews.Bootstrap4/Views/Account/Register.cshtml I switched the script reference on line 123:

<script src="~/cr/js/jqueryvaildation.submitonce-unobtrusive.min.js"></script>

to

<script src="~/cr/js/jqueryvaildation.submitonce-unobtrusive.js"></script>

and uncommented the console logging lines in this js file. This shows that the registration form validates successfully, but then the form is never actually submitted. An ajax username check is also performed and succeeds.

src/cloudscribe.Web.StaticFiles/js/jqueryvaildation.submitonce-unobtrusive.js

Yes, this file is spelt incorrectly, but it is referenced with this name in many of the admin/user views!

I tried stepping through the js in the browser debugger, but much of the code is minified in the other libraries being used.

Interestingly, if we switch off submit once by setting the form tag attribute data-submit-once="false" in the Register.cshtml file, then registration works just fine, with no apparent ill effects of double clicking the register button.

Needs a fresh pair of eyes to look at this, someone with better understanding of the whole jquery validation and Microsoft unobtrusive validation libraries!