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AAAC,MAED,SAAYvB,GACNE,KAAK+C,QACPjD,EAAIkD,SAAS,6BAEblD,EAAIkD,SAAS,8BAEjB,GAAC,CAAA5B,IAAA,iBAAAC,MAOD,WACE,OAAIrB,KAAKsB,QACD,GAANf,OAAUP,KAAKsB,QAAO,MAAAf,OAAKP,KAAKsD,kBAE3BtD,KAAKsD,gBACd,GAAC,CAAAlC,IAAA,eAAAC,MAED,WACE,OAAOrB,KAAKwB,KACd,M,8EAAC/B,CAAA,CArKW,GAyKda,IAAE,6BAA6BiD,MAAK,WAElC,IAAI9D,EAASa,IAAEN,MACjB,G","sources":["webpack://churchkey/./app/javascript/passwords.js"],"sourcesContent":["import zxcvbn from '@generalassembly/zxcvbn'\nimport $ from 'jquery'\n\n/* eslint-disable no-undef */\nconst FEEDBACK_MESSAGES = {\n use_a_few_words: I18n.t('account.form.password_feedback.use_a_few_words'),\n no_need_for_mixed_chars: I18n.t('account.form.password_feedback.no_need_for_mixed_chars'),\n uncommon_words_are_better: I18n.t('account.form.password_feedback.uncommon_words_are_better'),\n straight_rows_of_keys_are_easy: I18n.t('account.form.password_feedback.straight_rows_of_keys_are_easy'),\n short_keyboard_patterns_are_easy: I18n.t('account.form.password_feedback.short_keyboard_patterns_are_easy'),\n use_longer_keyboard_patterns: I18n.t('account.form.password_feedback.use_longer_keyboard_patterns'),\n repeated_chars_are_easy: I18n.t('account.form.password_feedback.repeated_chars_are_easy'),\n repeated_patterns_are_easy: I18n.t('account.form.password_feedback.repeated_patterns_are_easy'),\n avoid_repeated_chars: I18n.t('account.form.password_feedback.avoid_repeated_chars'),\n sequences_are_easy: I18n.t('account.form.password_feedback.sequences_are_easy'),\n avoid_sequences: I18n.t('account.form.password_feedback.avoid_sequences'),\n recent_years_are_easy: I18n.t('account.form.password_feedback.recent_years_are_easy'),\n avoid_recent_years: I18n.t('account.form.password_feedback.avoid_recent_years'),\n avoid_associated_years: I18n.t('account.form.password_feedback.avoid_associated_years'),\n dates_are_easy: I18n.t('account.form.password_feedback.dates_are_easy'),\n avoid_associated_dates_and_years: I18n.t('account.form.password_feedback.avoid_associated_dates_and_years'),\n top10_common_password: I18n.t('account.form.password_feedback.top10_common_password'),\n top100_common_password: I18n.t('account.form.password_feedback.top100_common_password'),\n very_common_password: I18n.t('account.form.password_feedback.very_common_password'),\n similar_to_common_password: I18n.t('account.form.password_feedback.similar_to_common_password'),\n a_word_is_easy: I18n.t('account.form.password_feedback.a_word_is_easy'),\n names_are_easy: I18n.t('account.form.password_feedback.names_are_easy'),\n common_names_are_easy: I18n.t('account.form.password_feedback.common_names_are_easy'),\n capitalization_doesnt_help: I18n.t('account.form.password_feedback.capitalization_doesnt_help'),\n all_uppercase_doesnt_help: I18n.t('account.form.password_feedback.all_uppercase_doesnt_help'),\n reverse_doesnt_help: I18n.t('account.form.password_feedback.reverse_doesnt_help'),\n substitution_doesnt_help: I18n.t('account.form.password_feedback.substitution_doesnt_help'),\n user_dictionary: I18n.t('account.form.password_feedback.user_dictionary'),\n}\n/* eslint-enable no-undef */\nclass Password {\n constructor(passwordEl) {\n this.clearState()\n\n this.passwordEl = passwordEl\n this.passwordName = passwordEl.attr('data-password-name')\n this.scoreThreshold = passwordEl.attr('data-min-complexity')\n\n this.meterEl = $(\n `.password-meter[data-for-password=\"${this.passwordName}\"]`,\n )\n this.warningEl = $(\n `.password-warning[data-for-password=\"${this.passwordName}\"]`,\n )\n this.suggestionsEl = this.warningEl.find('.password-suggestions')\n this.confirmationEl = $(\n `.password-confirmation[data-for-password=\"${this.passwordName}\"]`,\n )\n this.submitEl = $(`.submit[data-for-password=\"${this.passwordName}\"]`)\n this.suggestionTemplate = this.suggestionsEl.find('.password-suggestion')\n this.suggestionTemplate.remove()\n\n this.showWarning = false\n\n passwordEl.on('keyup', () => this.onKeyup())\n passwordEl.on('blur', () => {\n this.showWarning = true\n this.setState()\n this.render()\n })\n }\n\n onKeyup() {\n this.setState()\n this.render()\n }\n\n clearState() {\n this.warning = ''\n this.suggestions = []\n this.score = ''\n }\n\n setState() {\n this.clearState()\n\n if (this.blank()) {\n this.showWarning = false\n return\n }\n\n // eslint-disable-next-line no-undef\n I18n.locale = I18n.locale\n const result = zxcvbn(this.passwordEl.val(), {\n feedback_messages: FEEDBACK_MESSAGES,\n })\n\n this.warning = result.feedback.warning\n this.suggestions = result.feedback.suggestions\n this.score = result.score\n this.guesses_log10 = result.guesses_log10\n }\n\n valid() {\n return this.score >= this.scoreThreshold\n }\n\n blank() {\n return !this.passwordEl.val()\n }\n\n clear() {\n this.warningEl.removeClass('password-warning--visible')\n this.warningEl.find('.password-warning-message').empty()\n this.warningEl.find('.password-suggestions').empty()\n this.meterEl\n .find('.password-meter-bar')\n .toArray()\n .forEach(bar => this.deactivateBar($(bar)))\n this.confirmationEl.removeAttr('disabled')\n this.submitEl.removeAttr('disabled')\n this.passwordEl.removeClass('password--invalid')\n this.meterEl.removeClass('password-meter--invalid')\n }\n\n render() {\n this.clear()\n\n if (this.blank()) {\n return\n }\n\n this.renderMeter()\n\n if (this.showWarning) {\n this.renderWarning()\n this.renderInputErrors()\n }\n }\n\n renderMeter() {\n const numberOfBars = this.numberOfBars()\n\n this.meterEl\n .find('.password-meter-bar')\n .toArray()\n .forEach((bar) => {\n if (numberOfBars >= $(bar).data('score')) {\n this.activateBar($(bar))\n }\n })\n }\n\n renderWarning() {\n if (!this.valid()) {\n this.warningEl.addClass('password-warning--visible')\n }\n\n if (this.warning) {\n this.warningEl\n .find('.password-warning-message')\n .append(`${this.warning}.`)\n }\n\n this.suggestions.forEach((suggestion) => {\n this.suggestionTemplate\n .clone()\n .html(suggestion)\n .appendTo(this.suggestionsEl)\n })\n }\n\n renderInputErrors() {\n if (this.valid()) {\n return\n }\n\n this.confirmationEl.attr('disabled', 'disabled')\n this.submitEl.attr('disabled', 'disabled')\n this.passwordEl.addClass('password--invalid')\n this.meterEl.addClass('password-meter--invalid')\n }\n\n activateBar(bar) {\n if (this.valid()) {\n bar.addClass('password-meter-bar--valid')\n } else {\n bar.addClass('password-meter-bar--invalid')\n }\n }\n\n deactivateBar = (bar) => {\n bar.removeClass('password-meter-bar--valid')\n bar.removeClass('password-meter-bar--invalid')\n }\n\n warningMessage() {\n if (this.warning) {\n return `${this.warning}. ${this.defaultWarning()}`\n }\n return this.defaultWarning()\n }\n\n numberOfBars() {\n return this.score\n }\n}\n\n// eslint-disable-next-line func-names\n$('.with-password-complexity').each(function () {\n // eslint-disable-next-line no-new\n new Password($(this))\n})\n"],"names":["FEEDBACK_MESSAGES","use_a_few_words","I18n","t","no_need_for_mixed_chars","uncommon_words_are_better","straight_rows_of_keys_are_easy","short_keyboard_patterns_are_easy","use_longer_keyboard_patterns","repeated_chars_are_easy","repeated_patterns_are_easy","avoid_repeated_chars","sequences_are_easy","avoid_sequences","recent_years_are_easy","avoid_recent_years","avoid_associated_years","dates_are_easy","avoid_associated_dates_and_years","top10_common_password","top100_common_password","very_common_password","similar_to_common_password","a_word_is_easy","names_are_easy","common_names_are_easy","capitalization_doesnt_help","all_uppercase_doesnt_help","reverse_doesnt_help","substitution_doesnt_help","user_dictionary","Password","passwordEl","_this","_classCallCheck","deactivateBar","bar","removeClass","this","clearState","passwordName","attr","scoreThreshold","meterEl","$","concat","warningEl","suggestionsEl","find","confirmationEl","submitEl","suggestionTemplate","remove","showWarning","on","onKeyup","setState","render","key","value","warning","suggestions","score","blank","locale","result","zxcvbn","val","feedback_messages","feedback","guesses_log10","_this2","empty","toArray","forEach","removeAttr","clear","renderMeter","renderWarning","renderInputErrors","_this3","numberOfBars","data","activateBar","_this4","valid","addClass","append","suggestion","clone","html","appendTo","defaultWarning","each"],"sourceRoot":""}