2020-10-17 05:12:00 -06:00
|
|
|
<template>
|
2020-11-25 05:31:34 -07:00
|
|
|
<FormBase>
|
|
|
|
<X2fa/>
|
2021-04-20 08:22:59 -06:00
|
|
|
<FormLink to="/settings/2fa"><template #icon><i class="fas fa-mobile-alt"></i></template>{{ $ts.twoStepAuthentication }}</FormLink>
|
2020-12-25 18:47:36 -07:00
|
|
|
<FormButton primary @click="change()">{{ $ts.changePassword }}</FormButton>
|
2020-11-25 05:31:34 -07:00
|
|
|
<FormPagination :pagination="pagination">
|
2020-12-25 18:47:36 -07:00
|
|
|
<template #label>{{ $ts.signinHistory }}</template>
|
2020-11-25 05:31:34 -07:00
|
|
|
<template #default="{items}">
|
2021-09-29 09:50:45 -06:00
|
|
|
<div class="_debobigegoPanel timnmucd" v-for="item in items" :key="item.id">
|
2020-11-25 05:31:34 -07:00
|
|
|
<header>
|
2021-04-20 08:22:59 -06:00
|
|
|
<i v-if="item.success" class="fas fa-check icon succ"></i>
|
|
|
|
<i v-else class="fas fa-times-circle icon fail"></i>
|
2020-11-25 05:31:34 -07:00
|
|
|
<code class="ip _monospace">{{ item.ip }}</code>
|
|
|
|
<MkTime :time="item.createdAt" class="time"/>
|
|
|
|
</header>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</FormPagination>
|
|
|
|
<FormGroup>
|
2021-04-20 08:22:59 -06:00
|
|
|
<FormButton danger @click="regenerateToken"><i class="fas fa-sync-alt"></i> {{ $ts.regenerateLoginToken }}</FormButton>
|
2020-12-25 18:47:36 -07:00
|
|
|
<template #caption>{{ $ts.regenerateLoginTokenDescription }}</template>
|
2020-11-25 05:31:34 -07:00
|
|
|
</FormGroup>
|
|
|
|
</FormBase>
|
2020-10-17 05:12:00 -06:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-09-29 09:50:45 -06:00
|
|
|
import FormBase from '@client/components/debobigego/base.vue';
|
|
|
|
import FormLink from '@client/components/debobigego/link.vue';
|
|
|
|
import FormGroup from '@client/components/debobigego/group.vue';
|
|
|
|
import FormButton from '@client/components/debobigego/button.vue';
|
|
|
|
import FormPagination from '@client/components/debobigego/pagination.vue';
|
2021-03-23 02:30:14 -06:00
|
|
|
import * as os from '@client/os';
|
2021-04-09 21:54:12 -06:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-10-17 05:12:00 -06:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
2020-11-25 05:31:34 -07:00
|
|
|
FormBase,
|
|
|
|
FormLink,
|
|
|
|
FormButton,
|
|
|
|
FormPagination,
|
|
|
|
FormGroup,
|
2020-10-17 05:12:00 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-09 21:54:12 -06:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-25 18:47:36 -07:00
|
|
|
title: this.$ts.security,
|
2021-09-29 09:50:45 -06:00
|
|
|
icon: 'fas fa-lock',
|
|
|
|
bg: 'var(--bg)',
|
2020-10-17 05:12:00 -06:00
|
|
|
},
|
2020-11-25 05:31:34 -07:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'i/signin-history',
|
|
|
|
limit: 5,
|
|
|
|
},
|
2020-10-17 05:12:00 -06:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2021-04-09 21:54:12 -06:00
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
2020-10-17 05:12:00 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async change() {
|
|
|
|
const { canceled: canceled1, result: currentPassword } = await os.dialog({
|
2020-12-25 18:47:36 -07:00
|
|
|
title: this.$ts.currentPassword,
|
2020-10-17 05:12:00 -06:00
|
|
|
input: {
|
|
|
|
type: 'password'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (canceled1) return;
|
|
|
|
|
|
|
|
const { canceled: canceled2, result: newPassword } = await os.dialog({
|
2020-12-25 18:47:36 -07:00
|
|
|
title: this.$ts.newPassword,
|
2020-10-17 05:12:00 -06:00
|
|
|
input: {
|
|
|
|
type: 'password'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (canceled2) return;
|
|
|
|
|
|
|
|
const { canceled: canceled3, result: newPassword2 } = await os.dialog({
|
2020-12-25 18:47:36 -07:00
|
|
|
title: this.$ts.newPasswordRetype,
|
2020-10-17 05:12:00 -06:00
|
|
|
input: {
|
|
|
|
type: 'password'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (canceled3) return;
|
|
|
|
|
|
|
|
if (newPassword !== newPassword2) {
|
|
|
|
os.dialog({
|
|
|
|
type: 'error',
|
2020-12-25 18:47:36 -07:00
|
|
|
text: this.$ts.retypedNotMatch
|
2020-10-17 05:12:00 -06:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
os.apiWithDialog('i/change-password', {
|
|
|
|
currentPassword,
|
|
|
|
newPassword
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
regenerateToken() {
|
|
|
|
os.dialog({
|
2020-12-25 18:47:36 -07:00
|
|
|
title: this.$ts.password,
|
2020-10-17 05:12:00 -06:00
|
|
|
input: {
|
|
|
|
type: 'password'
|
|
|
|
}
|
|
|
|
}).then(({ canceled, result: password }) => {
|
|
|
|
if (canceled) return;
|
|
|
|
os.api('i/regenerate_token', {
|
|
|
|
password: password
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2020-11-25 05:31:34 -07:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.timnmucd {
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
> .icon {
|
|
|
|
width: 1em;
|
|
|
|
margin-right: 0.75em;
|
|
|
|
|
|
|
|
&.succ {
|
|
|
|
color: var(--success);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.fail {
|
|
|
|
color: var(--error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:12:01 -07:00
|
|
|
> .ip {
|
2020-12-11 20:13:27 -07:00
|
|
|
flex: 1;
|
2020-12-11 20:12:01 -07:00
|
|
|
min-width: 0;
|
|
|
|
white-space: nowrap;
|
2021-03-02 06:57:16 -07:00
|
|
|
overflow: hidden;
|
2020-12-11 20:12:01 -07:00
|
|
|
text-overflow: ellipsis;
|
2020-12-11 20:13:27 -07:00
|
|
|
margin-right: 12px;
|
2020-12-11 20:12:01 -07:00
|
|
|
}
|
|
|
|
|
2020-11-25 05:31:34 -07:00
|
|
|
> .time {
|
|
|
|
margin-left: auto;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|