Skip to content

Commit

Permalink
Merge pull request #10685 from owncloud/fix-banned-password-error-cap…
Browse files Browse the repository at this point in the history
…italization

fix: capitalization of banned password error message
  • Loading branch information
JammingBen authored Apr 2, 2024
2 parents 6697194 + cda6b9a commit f28bc39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
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

0 comments on commit f28bc39

Please sign in to comment.