
/* /dtg_auth_password_policy/static/src/js/check_password_mixin.js */
odoo.define('@dtg_auth_password_policy/js/check_password_mixin',['@web/core/l10n/translation'],function(require){'use strict';let __exports={};const{_t}=require("@web/core/l10n/translation");const checkPasswordMixin=__exports.checkPasswordMixin={_validatePassword:function(elPasswordInput){let _checkPasswordRequire=(req)=>req.toLowerCase()==='true';const passNumeric=_checkPasswordRequire(elPasswordInput.dataset.passwordNumeric);const passwordSpecial=_checkPasswordRequire(elPasswordInput.dataset.passwordSpecial);const passwordLowercase=_checkPasswordRequire(elPasswordInput.dataset.passwordLowercase);const passwordUppercase=_checkPasswordRequire(elPasswordInput.dataset.passwordUppercase);const passwordMinLength=parseInt(elPasswordInput.dataset.passwordLength,10)||0;const specialChars=/[!@#$%^&*(),.?":{}|<>]/;const password=elPasswordInput.value;let errorMessage=``;if(passwordLowercase&&!/[a-z]/.test(password)){errorMessage=_t('Your password must contain at least 1 lowercase character (a-z).');}else if(passwordUppercase&&!/[A-Z]/.test(password)){errorMessage=_t('Your password must contain at least 1 uppercase character (A-Z).');}else if(passNumeric&&!/\d/.test(password)){errorMessage=_t('Your password must contain at least 1 numeric character (0-9).');}else if(passwordSpecial&&!specialChars.test(password)){errorMessage=_t('Your password must contain at least 1 special character (!@#$%^&*(),.?":{}|<>).');}else if(password.length<passwordMinLength){errorMessage=_t('Your password must be at least %s characters long.',passwordMinLength);}
if(!!errorMessage){elPasswordInput.setCustomValidity(errorMessage);elPasswordInput.reportValidity();}else{elPasswordInput.setCustomValidity('');}},}
return __exports;});