fix: login input hints

This commit is contained in:
NGPixel 2020-07-20 00:22:29 -04:00
parent e9044698c9
commit 26af63a80b
4 changed files with 28 additions and 9 deletions

View File

@ -40,7 +40,9 @@
hide-details hide-details
ref='iptEmail' ref='iptEmail'
v-model='username' v-model='username'
:placeholder='$t(selectedStrategy.strategy.usernameLabel)' :placeholder='isUsernameEmail ? $t(`auth:fields.email`) : $t(`auth:fields.username`)'
:type='isUsernameEmail ? `email` : `text`'
:autocomplete='isUsernameEmail ? `email` : `username`'
) )
v-text-field.mt-2( v-text-field.mt-2(
solo solo
@ -54,6 +56,7 @@
@click:append='() => (hidePassword = !hidePassword)' @click:append='() => (hidePassword = !hidePassword)'
:type='hidePassword ? "password" : "text"' :type='hidePassword ? "password" : "text"'
:placeholder='$t("auth:fields.password")' :placeholder='$t("auth:fields.password")'
autocomplete='current-password'
@keyup.enter='login' @keyup.enter='login'
) )
v-btn.mt-2.text-none( v-btn.mt-2.text-none(
@ -95,7 +98,9 @@
hide-details hide-details
ref='iptForgotPwdEmail' ref='iptForgotPwdEmail'
v-model='username' v-model='username'
:placeholder='$t(selectedStrategy.strategy.usernameLabel)' :placeholder='$t(`auth:fields.email`)'
type='email'
autocomplete='email'
) )
v-btn.mt-2.text-none( v-btn.mt-2.text-none(
width='100%' width='100%'
@ -130,6 +135,7 @@
ref='iptNewPassword' ref='iptNewPassword'
v-model='newPassword' v-model='newPassword'
:placeholder='$t(`auth:changePwd.newPasswordPlaceholder`)' :placeholder='$t(`auth:changePwd.newPasswordPlaceholder`)'
autocomplete='new-password'
) )
password-strength(slot='progress', v-model='newPassword') password-strength(slot='progress', v-model='newPassword')
v-text-field.mt-2( v-text-field.mt-2(
@ -141,6 +147,7 @@
hide-details hide-details
v-model='newPasswordVerify' v-model='newPasswordVerify'
:placeholder='$t(`auth:changePwd.newPasswordVerifyPlaceholder`)' :placeholder='$t(`auth:changePwd.newPasswordVerifyPlaceholder`)'
autocomplete='new-password'
@keyup.enter='changePassword' @keyup.enter='changePassword'
) )
v-btn.mt-2.text-none( v-btn.mt-2.text-none(
@ -168,6 +175,7 @@
ref='iptTFA' ref='iptTFA'
v-model='securityCode' v-model='securityCode'
:placeholder='$t("auth:tfa.placeholder")' :placeholder='$t("auth:tfa.placeholder")'
autocomplete='one-time-code'
@keyup.enter='verifySecurityCode' @keyup.enter='verifySecurityCode'
) )
v-btn.mt-2.text-none( v-btn.mt-2.text-none(
@ -210,7 +218,7 @@ export default {
error: false, error: false,
strategies: [], strategies: [],
selectedStrategyKey: 'unselected', selectedStrategyKey: 'unselected',
selectedStrategy: { key: 'unselected', strategy: { useForm: false } }, selectedStrategy: { key: 'unselected', strategy: { useForm: false, usernameType: 'email' } },
screen: 'login', screen: 'login',
username: '', username: '',
password: '', password: '',
@ -242,6 +250,9 @@ export default {
} else { } else {
return this.strategies return this.strategies
} }
},
isUsernameEmail () {
return this.selectedStrategy.strategy.usernameType === `email`
} }
}, },
watch: { watch: {
@ -403,7 +414,15 @@ export default {
icon: 'check' icon: 'check'
}) })
_.delay(() => { _.delay(() => {
window.location.replace('/') // TEMPORARY - USE RETURNURL const loginRedirect = Cookies.get('loginRedirect')
if (loginRedirect) {
Cookies.remove('loginRedirect')
window.location.replace(loginRedirect)
} else if (respObj.redirect) {
window.location.replace(respObj.redirect)
} else {
window.location.replace('/')
}
}, 1000) }, 1000)
this.isLoading = false this.isLoading = false
} else { } else {
@ -467,7 +486,7 @@ export default {
forgotPassword () { forgotPassword () {
this.screen = 'forgot' this.screen = 'forgot'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.iptEmailForgot.focus() this.$refs.iptForgotPwdEmail.focus()
}) })
}, },
/** /**
@ -494,7 +513,7 @@ export default {
color color
icon icon
useForm useForm
usernameLabel usernameType
} }
displayName displayName
order order

View File

@ -85,7 +85,7 @@ type AuthenticationStrategy {
description: String description: String
isAvailable: Boolean isAvailable: Boolean
useForm: Boolean! useForm: Boolean!
usernameLabel: String usernameType: String
logo: String logo: String
color: String color: String
website: String website: String

View File

@ -7,7 +7,7 @@ color: blue darken-3
website: https://www.microsoft.com/windowsserver website: https://www.microsoft.com/windowsserver
isAvailable: true isAvailable: true
useForm: true useForm: true
usernameLabel: 'auth:fields.username' usernameType: username
props: props:
url: url:
title: LDAP URL title: LDAP URL

View File

@ -7,5 +7,5 @@ color: primary
website: https://wiki.js.org website: https://wiki.js.org
isAvailable: true isAvailable: true
useForm: true useForm: true
usernameLabel: 'auth:fields.email' usernameType: email
props: {} props: {}