mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-23 05:41:05 +01:00
Enhance some fields design for more effective forms
This commit is contained in:
parent
acdaa73e62
commit
b44c6958e3
@ -2,7 +2,16 @@
|
||||
<div class="field" :class="{ 'pt-3' : hasOffset }">
|
||||
<label :for="this.inputId(inputType,fieldName)" class="label" v-html="label"></label>
|
||||
<div class="control">
|
||||
<input :disabled="isDisabled" :id="this.inputId(inputType,fieldName)" :type="inputType" class="input" v-model="form[fieldName]" :placeholder="placeholder" v-bind="$attrs" v-on:change="$emit('field-changed', form[fieldName])"/>
|
||||
<input
|
||||
:disabled="isDisabled"
|
||||
:id="this.inputId(inputType,fieldName)"
|
||||
:type="inputType"
|
||||
class="input"
|
||||
v-model="form[fieldName]"
|
||||
:placeholder="placeholder"
|
||||
v-bind="$attrs"
|
||||
v-on:change="$emit('field-changed', form[fieldName])"
|
||||
/>
|
||||
</div>
|
||||
<field-error :form="form" :field="fieldName" />
|
||||
<p class="help" v-html="help" v-if="help"></p>
|
||||
|
@ -2,7 +2,17 @@
|
||||
<div class="field" :class="{ 'pt-3' : hasOffset }">
|
||||
<label :for="this.inputId('password',fieldName)" class="label" v-html="label"></label>
|
||||
<div class="control has-icons-right">
|
||||
<input :disabled="isDisabled" :id="this.inputId('password',fieldName)" :type="currentType" class="input" v-model="form[fieldName]" :placeholder="placeholder" v-bind="$attrs" v-on:change="$emit('field-changed', form[fieldName])"/>
|
||||
<input
|
||||
:disabled="isDisabled"
|
||||
:id="this.inputId('password',fieldName)"
|
||||
:type="currentType"
|
||||
class="input"
|
||||
v-model="form[fieldName]"
|
||||
:placeholder="placeholder"
|
||||
v-bind="$attrs"
|
||||
v-on:change="$emit('field-changed', form[fieldName])"
|
||||
v-on:keyup="checkCapsLock"
|
||||
/>
|
||||
<span v-if="currentType == 'password'" class="icon is-small is-right is-clickable" @click="currentType = 'text'" :title="$t('auth.forms.reveal_password')">
|
||||
<font-awesome-icon :icon="['fas', 'eye-slash']" />
|
||||
</span>
|
||||
@ -10,6 +20,7 @@
|
||||
<font-awesome-icon :icon="['fas', 'eye']" />
|
||||
</span>
|
||||
</div>
|
||||
<p class="help is-warning" v-if="hasCapsLockOn" v-html="$t('auth.forms.caps_lock_is_on')" />
|
||||
<field-error :form="form" :field="fieldName" />
|
||||
<p class="help" v-html="help" v-if="help"></p>
|
||||
<div v-if="showRules" class="columns is-mobile is-size-7 mt-0">
|
||||
@ -35,7 +46,8 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
currentType: this.inputType
|
||||
currentType: this.inputType,
|
||||
hasCapsLockOn: false,
|
||||
}
|
||||
},
|
||||
|
||||
@ -104,5 +116,11 @@
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
checkCapsLock(event) {
|
||||
this.hasCapsLockOn = event.getModifierState('CapsLock') ? true : false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
@ -112,7 +112,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<field-error :form="form" field="secret" class="help-for-file" />
|
||||
<field-error :form="form" field="secret" />
|
||||
<p class="help" v-html="$t('twofaccounts.forms.secret.help')"></p>
|
||||
</div>
|
||||
<div v-if="form.otp_type !== 'steamtotp'">
|
||||
@ -125,9 +125,9 @@
|
||||
<!-- algorithm -->
|
||||
<form-toggle :form="form" :choices="algorithms" fieldName="algorithm" :label="$t('twofaccounts.forms.algorithm.label')" :help="$t('twofaccounts.forms.algorithm.help')" />
|
||||
<!-- TOTP period -->
|
||||
<form-field v-if="form.otp_type === 'totp'" :form="form" fieldName="period" inputType="text" :label="$t('twofaccounts.forms.period.label')" :placeholder="$t('twofaccounts.forms.period.placeholder')" :help="$t('twofaccounts.forms.period.help')" />
|
||||
<form-field v-if="form.otp_type === 'totp'" pattern="[0-9]" :class="'is-third-width-field'" :form="form" fieldName="period" inputType="text" :label="$t('twofaccounts.forms.period.label')" :placeholder="$t('twofaccounts.forms.period.placeholder')" :help="$t('twofaccounts.forms.period.help')" />
|
||||
<!-- HOTP counter -->
|
||||
<form-field v-if="form.otp_type === 'hotp'" :form="form" fieldName="counter" inputType="text" :label="$t('twofaccounts.forms.counter.label')" :placeholder="$t('twofaccounts.forms.counter.placeholder')" :help="$t('twofaccounts.forms.counter.help')" />
|
||||
<form-field v-if="form.otp_type === 'hotp'" pattern="[0-9]" :class="'is-third-width-field'" :form="form" fieldName="counter" inputType="text" :label="$t('twofaccounts.forms.counter.label')" :placeholder="$t('twofaccounts.forms.counter.placeholder')" :help="$t('twofaccounts.forms.counter.help')" />
|
||||
</div>
|
||||
</div>
|
||||
<vue-footer :showButtons="true">
|
||||
|
@ -116,6 +116,7 @@
|
||||
'is_long_enough' => '8 characters min.',
|
||||
'mandatory_rules' => 'Mandatory rules',
|
||||
'optional_rules_you_should_follow' => 'Optional rules (highly recommanded)',
|
||||
'caps_lock_is_on' => 'Caps lock is On',
|
||||
],
|
||||
|
||||
];
|
||||
|
12
resources/sass/app.scss
vendored
12
resources/sass/app.scss
vendored
@ -399,6 +399,18 @@ figure.no-icon {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.is-mid-width-field input {
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.is-half-width-field input {
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.is-third-width-field input {
|
||||
width: 33% !important;
|
||||
}
|
||||
|
||||
.is-toggle.buttons,
|
||||
.is-toggle.buttons a.button {
|
||||
margin-bottom: 0 !important;
|
||||
|
Loading…
Reference in New Issue
Block a user