diff --git a/frontend/src/components/Inputs/InputPasswordConfirmation.vue b/frontend/src/components/Inputs/InputPasswordConfirmation.vue index d0dc81156..ecb3aa55a 100644 --- a/frontend/src/components/Inputs/InputPasswordConfirmation.vue +++ b/frontend/src/components/Inputs/InputPasswordConfirmation.vue @@ -10,6 +10,7 @@ containsNumericCharacter: true, atLeastEightCharactera: true, atLeastOneSpecialCharater: true, + noWhitespaceCharacters: true, }" :label="register ? $t('form.password') : $t('form.password_new')" :showAllErrors="true" diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index c7a0946f5..f998df196 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -167,6 +167,7 @@ "dont_match": "Die Passwörter stimmen nicht überein.", "lowercase": "Ein Kleinbuchstabe erforderlich.", "minimum": "Mindestens 8 Zeichen.", + "no-whitespace": "Keine Leerzeichen und Tabulatoren", "one_number": "Eine Zahl erforderlich.", "special-char": "Ein Sonderzeichen erforderlich (z.B. _ oder ä)", "subtitle": "Werde Teil der Gemeinschaft!", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index b3148fe3f..e7eba4b93 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -167,6 +167,7 @@ "dont_match": "Passwords don't match.", "lowercase": "One lowercase letter required.", "minimum": "8 characters minimum.", + "no-whitespace": "No white spaces and tabs", "one_number": "One number required.", "special-char": "One special character required (e.g. _ or ä)", "subtitle": "Become a part of the community!", diff --git a/frontend/src/validation-rules.js b/frontend/src/validation-rules.js index e836de56b..9ea954a92 100644 --- a/frontend/src/validation-rules.js +++ b/frontend/src/validation-rules.js @@ -114,11 +114,18 @@ export const loadAllRules = (i18nCallback) => { extend('atLeastOneSpecialCharater', { validate(value) { - return !!value.match(/[^a-zA-Z0-9 \t\n]/) + return !!value.match(/[^a-zA-Z0-9]/) }, message: (_, values) => i18nCallback.t('site.signup.special-char', values), }) + extend('noWhitespaceCharacters', { + validate(value) { + return !!value.match(/[^ \t\n\r]/) + }, + message: (_, values) => i18nCallback.t('site.signup.no-whitespace', values), + }) + extend('samePassword', { validate(value, [pwd]) { return value === pwd diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js index 7e9703c02..a1fa1dd3f 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js @@ -105,13 +105,14 @@ describe('UserCard_FormUserPasswort', () => { describe('validation', () => { it('displays all password requirements', () => { const feedbackArray = wrapper.findAll('div.invalid-feedback').at(1).findAll('span') - expect(feedbackArray).toHaveLength(6) + expect(feedbackArray).toHaveLength(7) expect(feedbackArray.at(0).text()).toBe('validations.messages.required') expect(feedbackArray.at(1).text()).toBe('site.signup.lowercase') expect(feedbackArray.at(2).text()).toBe('site.signup.uppercase') expect(feedbackArray.at(3).text()).toBe('site.signup.one_number') expect(feedbackArray.at(4).text()).toBe('site.signup.minimum') expect(feedbackArray.at(5).text()).toBe('site.signup.special-char') + expect(feedbackArray.at(6).text()).toBe('site.signup.no-whitespace') }) it('removes first message when a character is given', async () => {