diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index bbc63e93a..57429baa3 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -31,11 +31,7 @@ ref="password" :type="showPassword ? 'text' : 'password'" /> - - - - - + {{ $t('login.forgotPassword') }} @@ -60,11 +56,13 @@ import links from '~/constants/links.js' import metadata from '~/constants/metadata.js' import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch' import Logo from '~/components/Logo/Logo' +import ShowPassword from '../ShowPassword/ShowPassword.vue' export default { components: { LocaleSwitch, Logo, + ShowPassword, }, data() { return { @@ -100,9 +98,8 @@ export default { } } }, - toggleShowPassword(event) { + toggleShowPassword() { this.showPassword = !this.showPassword - event.preventDefault() this.$nextTick(() => { this.$refs.password.$el.children[1].children[1].focus() this.$emit('focus') @@ -116,7 +113,7 @@ export default { .login-form { width: 80vw; max-width: 620px; - margin: auto; + /* margin: auto; */ .base-button { display: block; @@ -144,28 +141,6 @@ export default { outline: none; transition: all $duration-short $ease-out; - .icon-wrapper { - margin-right: 2px; - } - - .click-wrapper { - padding: 8px; - align-content: center; - color: $text-color-disabled; - cursor: pointer; - } - - .click-wrapper:hover { - &:focus-within { - background-color: $background-color-base; - border: $input-border-size solid $border-color-active; - - .toggle-icon { - color: $text-color-base; - } - } - } - &:focus-within { background-color: $background-color-base; border: $input-border-size solid $border-color-active; diff --git a/webapp/components/Registration/RegistrationSlideCreate.vue b/webapp/components/Registration/RegistrationSlideCreate.vue index 7ac235994..cab0e1cce 100644 --- a/webapp/components/Registration/RegistrationSlideCreate.vue +++ b/webapp/components/Registration/RegistrationSlideCreate.vue @@ -40,24 +40,43 @@ :label="$t('settings.data.labelName')" :placeholder="$t('settings.data.namePlaceholder')" /> - - + +
+ + +
+ +
+ + +
- { + this.$refs.password.$el.children[1].children[0].focus() + this.$emit('focus') + }) + } else { + this.showPasswordConfirm = !this.showPasswordConfirm + this.$nextTick(() => { + this.$refs.confirmPassword.$el.children[1].children[0].focus() + this.$emit('focus') + }) + } + }, }, } @@ -259,4 +303,44 @@ export default { .password-strength { margin-bottom: 14px; } + +.password-wrapper { + display: flex; + width: 100%; + align-items: center; + padding: $input-padding-vertical $space-x-small; + padding-left: 0; + padding-right: 0; + height: $input-height; + margin-bottom: 10px; + margin-bottom: 16px; + + color: $text-color-base; + background: $background-color-disabled; + + border: $input-border-size solid $border-color-softer; + border-left: none; + border-radius: $border-radius-base; + outline: none; + transition: all $duration-short $ease-out; + + &:focus-within { + background-color: $background-color-base; + border: $input-border-size solid $border-color-active; + + .toggle-icon { + color: $text-color-base; + } + } + + .password-field { + position: relative; + padding-top: 16px; + border: none; + border-style: none; + appearance: none; + margin-left: 0; + width: 100%; + } +} diff --git a/webapp/components/ShowPassword/ShowPassword.spec.js b/webapp/components/ShowPassword/ShowPassword.spec.js new file mode 100644 index 000000000..6eb44f6b2 --- /dev/null +++ b/webapp/components/ShowPassword/ShowPassword.spec.js @@ -0,0 +1,33 @@ +import Vue from 'vue' +import { mount } from '@vue/test-utils' + +import ShowPassword from './ShowPassword.vue' + +describe('ShowPassword', () => { + describe('State of show password icon', () => { + const wrapper = mount(ShowPassword, { + propsData: { + iconName: 'eye', + }, + }) + + it('Shows eye icon by default', () => { + expect(wrapper.find('.icon-wrapper').attributes('data-test')).toEqual('eye') + }) + + describe('After click', () => { + it('Password wrapper emits show-password event', async () => { + wrapper.find('.click-wrapper').trigger('click') + await Vue.nextTick() + expect(wrapper.emitted()).toBeTruthy() + }) + + it('Shows the slash-eye icon after click', async () => { + wrapper.find('.click-wrapper').trigger('click') + wrapper.setProps({ iconName: 'eye-slash' }) + await Vue.nextTick() + expect(wrapper.find('.icon-wrapper').attributes('data-test')).toEqual('eye-slash') + }) + }) + }) +}) diff --git a/webapp/components/ShowPassword/ShowPassword.vue b/webapp/components/ShowPassword/ShowPassword.vue new file mode 100644 index 000000000..c31e01b25 --- /dev/null +++ b/webapp/components/ShowPassword/ShowPassword.vue @@ -0,0 +1,44 @@ + + + + +