elboletaire / password-strength-meter

:key: A password strength meter for jQuery
https://elboletaire.github.io/password-strength-meter/
GNU General Public License v3.0
107 stars 45 forks source link

Disabling text warnings and still listening for password.text event #8

Closed ilterocal closed 6 years ago

ilterocal commented 6 years ago

password.text event is not fired if text is disabled via options.

I don't want the plugin to render the text message. Instead I need to get the status text and render it my self. How can i achieve this?

elboletaire commented 6 years ago

You could use password.score instead, and make your own array of messages, something like:

const scores = {
  0: 'First message',
  10: 'Second message',
  200: 'Third message',
}
$('#password').on('password.score', (e, score) => {
  Object.keys(scores).forEach((sc) => {
    if (score <= sc) {
      $('.your-message-holder').text(scores[sc]);
    }
  })
})

Should do the trick.

Sorry for the delay btw, if you consider this is what you were searching for I'll close the ticket (or close it by yourself 😉).

elboletaire commented 6 years ago

Does this fit your needs @ilterocal?

elboletaire commented 6 years ago

Closed due to inactivity.