mirror of
https://github.com/Lissy93/dashy.git
synced 2025-12-06 08:34:14 +01:00
error message added in case of wrong pin
This commit is contained in:
parent
bcfb7cbbaf
commit
21b09952cb
4 changed files with 14 additions and 4 deletions
|
|
@ -255,7 +255,8 @@
|
|||
"unlock": "Unlock",
|
||||
"lock": "Lock",
|
||||
"lockedSection": "Locked section",
|
||||
"enter-pin": "Enter PIN"
|
||||
"enter-pin": "Enter PIN",
|
||||
"incorrect-pin": "Incorrect PIN"
|
||||
},
|
||||
"footer": {
|
||||
"dev-by": "Developed by",
|
||||
|
|
|
|||
|
|
@ -13,11 +13,13 @@
|
|||
/>
|
||||
|
||||
<div class="pin-actions">
|
||||
<div v-if="errorMessage" class="pin-error">{{ errorMessage }}</div>
|
||||
<button class="pin-btn" @click="submit" :aria-label="$t('pin.unlock')">
|
||||
<i class="fas fa-unlock-alt btn-icon" aria-hidden="true"></i>
|
||||
{{ $t('pin.unlock') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -29,6 +31,7 @@ export default {
|
|||
components: { FormSchema },
|
||||
props: {
|
||||
id: String,
|
||||
errorMessage: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<PinInput
|
||||
v-if="showPinRequired"
|
||||
:id = "sectionRef"
|
||||
:errorMessage="pinError"
|
||||
@unlock_attempt="saveUnlockPins"
|
||||
/>
|
||||
<div v-if="!showPinRequired">
|
||||
|
|
@ -168,6 +169,7 @@ export default {
|
|||
sectionWidth: 0,
|
||||
resizeObserver: null,
|
||||
isUnlocked: true,
|
||||
pinError: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -378,14 +380,13 @@ export default {
|
|||
const map = JSON.parse(sessionStorage.getItem(SECRET_UNLOCKED_KEY) || '{}');
|
||||
map[id] = pin;
|
||||
sessionStorage.setItem(SECRET_UNLOCKED_KEY, JSON.stringify(map));
|
||||
this.updateUnlocked();
|
||||
},
|
||||
updateUnlocked() {
|
||||
const unlockPins = JSON.parse(sessionStorage.getItem(SECRET_UNLOCKED_KEY) || '{}');
|
||||
const sectionKey = this.sectionRef;
|
||||
if (unlockPins[sectionKey] === this.pin) {
|
||||
this.pinError = '';
|
||||
this.isUnlocked = true;
|
||||
} else {
|
||||
this.pinError = this.$t('pin.incorrect-pin');
|
||||
this.isUnlocked = false;
|
||||
}
|
||||
},
|
||||
|
|
@ -396,6 +397,7 @@ export default {
|
|||
delete unlockPins[sectionKey];
|
||||
sessionStorage.setItem(SECRET_UNLOCKED_KEY, JSON.stringify(unlockPins));
|
||||
}
|
||||
this.pinError = '';
|
||||
this.isUnlocked = false;
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -63,3 +63,7 @@
|
|||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.pin-error {
|
||||
color: var(--error, #d9534f);
|
||||
}
|
||||
Loading…
Reference in a new issue