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 generate password doesnt reset banned password error, autofocus on password input doesn't work #9735

Merged
merged 3 commits into from
Sep 27, 2023
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 @@ -7,5 +7,6 @@ https://github.com/owncloud/web/pull/9682
https://github.com/owncloud/web/pull/9634
https://github.com/owncloud/web/pull/9686
https://github.com/owncloud/web/pull/9688
https://github.com/owncloud/web/pull/9735
https://github.com/owncloud/web/issues/9638
https://github.com/owncloud/web/issues/9657
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:is="inputComponent"
:id="id"
v-bind="additionalAttributes"
v-on="additionalListeners"
ref="input"
:aria-invalid="ariaInvalid"
class="oc-text-input oc-input oc-rounded"
Expand Down Expand Up @@ -261,6 +262,13 @@ export default defineComponent({
messageId() {
return `${this.id}-message`
},
additionalListeners() {
if (this.type === 'password') {
return { passwordGenerated: this.onInput }
}

return {}
},
additionalAttributes() {
const additionalAttrs = {}
if (!!this.warningMessage || !!this.errorMessage || !!this.descriptionMessage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
'oc-text-input-password-wrapper-danger': hasError
}"
>
<input v-bind="$attrs" v-model="password" :type="showPassword ? 'text' : 'password'" />
<input
v-bind="$attrs"
v-model="password"
:type="showPassword ? 'text' : 'password'"
ref="passwordInput"
/>
<oc-button
v-if="password"
v-oc-tooltip="$gettext('Show password')"
Expand Down Expand Up @@ -101,8 +106,9 @@ export default defineComponent({
default: false
}
},
emits: ['passwordChallengeCompleted', 'passwordChallengeFailed'],
setup(props, { emit, attrs }) {
emits: ['passwordChallengeCompleted', 'passwordChallengeFailed', 'passwordGenerated'],
setup(props, { emit }) {
const passwordInput = ref(null)
const { $gettext } = useGettext()
const password = ref(props.value)
const showPassword = ref(false)
Expand Down Expand Up @@ -138,6 +144,11 @@ export default defineComponent({
const generatedPassword = props.generatePasswordMethod()
password.value = generatedPassword
showPassword.value = true
emit('passwordGenerated', password.value)
}

const focus = () => {
unref(passwordInput).focus()
}

watch(password, (value) => {
Expand All @@ -155,9 +166,11 @@ export default defineComponent({
})

return {
focus,
$gettext,
password,
showPassword,
passwordInput,
copyPasswordIcon,
showPasswordPolicyInformation,
testedPasswordPolicy,
Expand Down