Browse Source

fix: revert i18n changes in sdk

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3475/head
Raju Udava 2 years ago
parent
commit
8baab22c65
  1. 32
      packages/nocodb-sdk/src/lib/passwordHelpers.ts

32
packages/nocodb-sdk/src/lib/passwordHelpers.ts

@ -1,46 +1,46 @@
import { getI18n } from '~/plugins/a.i18n'
export function validatePassword(p) { export function validatePassword(p) {
let error = ''; let error = '';
let progress = 0; let progress = 0;
let hint = null; let hint = null;
let valid = true; let valid = true;
const { t } = getI18n().global
if (!p) { if (!p) {
// 'At least 8 letters with one Uppercase, one number and one special letter'; error =
error = t('msg.error.signUpRules.completeRuleSet'); 'At least 8 letters with one Uppercase, one number and one special letter';
// error = t('msg.error.signUpRules.completeRuleSet');
valid = false; valid = false;
} else { } else {
if (!(p.length >= 8)) { if (!(p.length >= 8)) {
// error += 'At least 8 letters. '; error += 'At least 8 letters. ';
error += t('msg.error.signUpRules.atLeast8Char'); // error += t('msg.error.signUpRules.atLeast8Char');
valid = false; valid = false;
} else { } else {
progress = Math.min(100, progress + 25); progress = Math.min(100, progress + 25);
} }
if (!p.match(/.*[A-Z].*/)) { if (!p.match(/.*[A-Z].*/)) {
// error += 'One Uppercase Letter. '; error += 'One Uppercase Letter. ';
error += t('msg.error.signUpRules.atLeastOneUppercase'); // error += t('msg.error.signUpRules.atLeastOneUppercase');
valid = false; valid = false;
} else { } else {
progress = Math.min(100, progress + 25); progress = Math.min(100, progress + 25);
} }
if (!p.match(/.*[0-9].*/)) { if (!p.match(/.*[0-9].*/)) {
// error += 'One Number. '; error += 'One Number. ';
error += t('msg.error.signUpRules.atLeastOneNumber'); // error += t('msg.error.signUpRules.atLeastOneNumber');
valid = false; valid = false;
} else { } else {
progress = Math.min(100, progress + 25); progress = Math.min(100, progress + 25);
} }
if (!p.match(/[$&+,:;=?@#|'<>.^*()%!_-]/)) { if (!p.match(/[$&+,:;=?@#|'<>.^*()%!_-]/)) {
// error += 'One special letter. '; error += 'One special letter. ';
error += t('msg.error.signUpRules.atLeastOneSpecialChar'); // error += t('msg.error.signUpRules.atLeastOneSpecialChar');
// hint = "Allowed special character list : $&+,:;=?@#|'<>.^*()%!_-"; hint = "Allowed special character list : $&+,:;=?@#|'<>.^*()%!_-";
hint = `${t( // hint = `${t(
'msg.error.signUpRules.allowedSpecialCharList' // 'msg.error.signUpRules.allowedSpecialCharList'
)} : $&+,:;=?@#|'<>.^*()%!_-`; // )} : $&+,:;=?@#|'<>.^*()%!_-`;
valid = false; valid = false;
} else { } else {
progress = Math.min(100, progress + 25); progress = Math.min(100, progress + 25);

Loading…
Cancel
Save