Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: capitalization of banned password error message #10685

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<script lang="ts">
import { defineComponent, ref, unref, PropType } from 'vue'
import { useGettext } from 'vue3-gettext'
import { upperFirst } from 'lodash-es'
import {
Modal,
useClientService,
Expand Down Expand Up @@ -65,7 +66,8 @@ export default defineComponent({
} catch (e) {
// Human-readable error message is provided, for example when password is on banned list
if (e.response?.status === 400) {
errorMessage.value = $gettext(e.response.data.error.message)
const errorMsg = e.response.data.error.message
errorMessage.value = $gettext(upperFirst(errorMsg))
return Promise.reject()
}

Expand Down
5 changes: 4 additions & 1 deletion packages/web-pkg/src/components/CreateLinkModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<script lang="ts">
import { DateTime } from 'luxon'
import { v4 as uuidV4 } from 'uuid'
import { upperFirst } from 'lodash-es'
import { useGettext } from 'vue3-gettext'
import { computed, defineComponent, PropType, ref, reactive, unref, onMounted } from 'vue'
import {
Expand Down Expand Up @@ -280,7 +281,9 @@ export default defineComponent({
console.error(e)
// Human-readable error message is provided, for example when password is on banned list
if (e.response?.status === 400) {
userFacingErrors.push(e.response.data.error)
const error = e.response.data.error
error.message = upperFirst(error.message)
userFacingErrors.push(error)
}
})
}
Expand Down
6 changes: 2 additions & 4 deletions tests/e2e/cucumber/features/shares/link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,15 @@ Feature: link
| resource | password |
| lorem.txt | %public% |
When "Alice" tries to sets a new password "ownCloud-1" of the public link named "Link" of resource "lorem.txt"
# https://github.com/owncloud/ocis/issues/8624
Then "Alice" should see an error message
"""
unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety
Unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety
"""
And "Alice" closes the public link password dialog box
When "Alice" tries to sets a new password "ownCloud-1" of the public link named "Link" of resource "lorem.txt"
# https://github.com/owncloud/ocis/issues/8624
Then "Alice" should see an error message
"""
unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety
Unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety
"""
And "Alice" reveals the password of the public link
And "Alice" hides the password of the public link
Expand Down