开发者

jQuery password strength plugin: Retrieving password's strength

开发者 https://www.devze.com 2023-01-10 03:33 出处:网络
I\'m working on a legacy groovy project that uses jQuery\'s password strength validator plugin. It works great. However, a new requirement arrived today, indicating that the form should not be submite

I'm working on a legacy groovy project that uses jQuery's password strength validator plugin. It works great. However, a new requirement arrived today, indicating that the form should not be submited if the strength of the pas开发者_开发问答sword is below good (this is an arbitrary value)

Is there any way to achieve this? Possibly via javascript? Ajax solutions are welcome to.

Thanks in advance.


I see two ways of doing it:

  1. Check class of warning, it is something like ".password_strength_1", so strength is in its name.

  2. Just edit plugin :) It won't hurt.


Something like this may work:

$('#myform').submit(function(e) {
    if ($(this).find('.password_strength_1').size() != 0) {
        e.preventDefault();
        alert('Your password is too weak!');
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消