Extracted password input in a dedicated component
This commit is contained in:
parent
4325b1be4f
commit
cd22601f67
|
@ -35,21 +35,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label><i18next path="Old password"/></label>
|
<label><i18next path="Old password"/></label>
|
||||||
<input
|
<password-input required v-model="old_password" />
|
||||||
required
|
|
||||||
type="password"
|
|
||||||
autofocus
|
|
||||||
placeholder="Enter your old password"
|
|
||||||
v-model="old_password">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label><i18next path="New password"/></label>
|
<label><i18next path="New password"/></label>
|
||||||
<input
|
<password-input required v-model="new_password" />
|
||||||
required
|
|
||||||
type="password"
|
|
||||||
autofocus
|
|
||||||
placeholder="Enter your new password"
|
|
||||||
v-model="new_password">
|
|
||||||
</div>
|
</div>
|
||||||
<button :class="['ui', {'loading': isLoading}, 'button']" type="submit"><i18next path="Change password"/></button>
|
<button :class="['ui', {'loading': isLoading}, 'button']" type="submit"><i18next path="Change password"/></button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -62,8 +54,12 @@
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
import PasswordInput from '@/components/forms/PasswordInput'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
PasswordInput
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
let d = {
|
let d = {
|
||||||
// We need to initialize the component with any
|
// We need to initialize the component with any
|
||||||
|
|
|
@ -34,16 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<i18next tag="label" path="Password"/>
|
<i18next tag="label" path="Password"/>
|
||||||
<div class="ui action input">
|
<password-input v-model="password" />
|
||||||
<input
|
|
||||||
required
|
|
||||||
:type="passwordInputType"
|
|
||||||
placeholder="Enter your password"
|
|
||||||
v-model="password">
|
|
||||||
<span @click="showPassword = !showPassword" title="Show/hide password" class="ui icon button">
|
|
||||||
<i class="eye icon"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<button :class="['ui', 'green', {'loading': isLoading}, 'button']" type="submit"><i18next path="Create my account"/></button>
|
<button :class="['ui', 'green', {'loading': isLoading}, 'button']" type="submit"><i18next path="Create my account"/></button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -57,8 +48,13 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
|
import PasswordInput from '@/components/forms/PasswordInput'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'login',
|
name: 'login',
|
||||||
|
components: {
|
||||||
|
PasswordInput
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
next: {type: String, default: '/'}
|
next: {type: String, default: '/'}
|
||||||
},
|
},
|
||||||
|
@ -69,8 +65,7 @@ export default {
|
||||||
password: '',
|
password: '',
|
||||||
isLoadingInstanceSetting: true,
|
isLoadingInstanceSetting: true,
|
||||||
errors: [],
|
errors: [],
|
||||||
isLoading: false,
|
isLoading: false
|
||||||
showPassword: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
@ -104,16 +99,7 @@ export default {
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
passwordInputType () {
|
|
||||||
if (this.showPassword) {
|
|
||||||
return 'text'
|
|
||||||
}
|
}
|
||||||
return 'password'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<template>
|
||||||
|
<div class="ui action input">
|
||||||
|
<input
|
||||||
|
required
|
||||||
|
:tabindex="index"
|
||||||
|
:type="passwordInputType"
|
||||||
|
@input="$emit('input', $event.target.value)"
|
||||||
|
:value="value">
|
||||||
|
<span @click="showPassword = !showPassword" :title="$t('Show/hide password')" class="ui icon button">
|
||||||
|
<i class="eye icon"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: ['value', 'index'],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
showPassword: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
passwordInputType () {
|
||||||
|
if (this.showPassword) {
|
||||||
|
return 'text'
|
||||||
|
}
|
||||||
|
return 'password'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue