mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
Use Button component to show password for improved accessibility
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
744f1dd563
commit
8aaac57ee6
6 changed files with 43 additions and 30 deletions
|
|
@ -296,17 +296,6 @@ input[type='password'].password-with-toggle, input[type='text'].password-with-to
|
|||
width: 219px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
.toggle-password {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 5px;
|
||||
padding: 14px;
|
||||
height: 16px;
|
||||
}
|
||||
.toggle-password:hover,
|
||||
.toggle-password:focus {
|
||||
opacity: .6;
|
||||
}
|
||||
input.login {
|
||||
width: 260px;
|
||||
height: 50px;
|
||||
|
|
|
|||
|
|
@ -84,9 +84,15 @@
|
|||
required>
|
||||
<label for="password"
|
||||
class="infield">{{ t('Password') }}</label>
|
||||
<a href="#" class="toggle-password" @click.stop.prevent="togglePassword">
|
||||
<img :src="toggleIcon" :alt="t('core', 'Toggle password visibility')">
|
||||
</a>
|
||||
<Button class="toggle-password"
|
||||
type="tertiary-no-background"
|
||||
:aria-label="isPasswordHidden ? t('core', 'Show password') : t('core', 'Hide password')"
|
||||
@click.stop.prevent="togglePassword">
|
||||
<template #icon>
|
||||
<Eye v-if="isPasswordHidden" :size="20" />
|
||||
<EyeOff v-else :size="20" />
|
||||
</template>
|
||||
</Button>
|
||||
</p>
|
||||
|
||||
<LoginButton :loading="loading" />
|
||||
|
|
@ -128,15 +134,24 @@
|
|||
|
||||
<script>
|
||||
import jstz from 'jstimezonedetect'
|
||||
import { generateUrl, imagePath } from '@nextcloud/router'
|
||||
|
||||
import Button from '@nextcloud/vue/dist/Components/Button'
|
||||
import Eye from 'vue-material-design-icons/Eye'
|
||||
import EyeOff from 'vue-material-design-icons/EyeOff'
|
||||
|
||||
import LoginButton from './LoginButton'
|
||||
import {
|
||||
generateUrl,
|
||||
imagePath,
|
||||
} from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'LoginForm',
|
||||
components: { LoginButton },
|
||||
|
||||
components: {
|
||||
Button,
|
||||
Eye,
|
||||
EyeOff,
|
||||
LoginButton,
|
||||
},
|
||||
|
||||
props: {
|
||||
username: {
|
||||
type: String,
|
||||
|
|
@ -167,6 +182,7 @@ export default {
|
|||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
|
|
@ -177,6 +193,7 @@ export default {
|
|||
passwordInputType: 'password',
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
apacheAuthFailed() {
|
||||
return this.errors.indexOf('apacheAuthFailed') !== -1
|
||||
|
|
@ -190,16 +207,17 @@ export default {
|
|||
userDisabled() {
|
||||
return this.errors.indexOf('userdisabled') !== -1
|
||||
},
|
||||
toggleIcon() {
|
||||
return imagePath('core', 'actions/toggle.svg')
|
||||
},
|
||||
loadingIcon() {
|
||||
return imagePath('core', 'loading-dark.gif')
|
||||
},
|
||||
loginActionUrl() {
|
||||
return generateUrl('login')
|
||||
},
|
||||
isPasswordHidden() {
|
||||
return this.passwordInputType === 'password'
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.username === '') {
|
||||
this.$refs.user.focus()
|
||||
|
|
@ -207,6 +225,7 @@ export default {
|
|||
this.$refs.password.focus()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
togglePassword() {
|
||||
if (this.passwordInputType === 'password') {
|
||||
|
|
@ -226,6 +245,11 @@ export default {
|
|||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.toggle-password {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 10px;
|
||||
color: var(--color-text-lighter);
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
4
dist/core-common.js
vendored
4
dist/core-common.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-common.js.map
vendored
2
dist/core-common.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/core-login.js
vendored
4
dist/core-login.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-login.js.map
vendored
2
dist/core-login.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue