paricafe/packages/client/src/pages/settings/email-address.vue

71 lines
1.5 KiB
Vue
Raw Normal View History

<template>
<FormBase>
<FormGroup>
2021-09-29 10:50:45 -05:00
<FormInput v-model="emailAddress" type="email">
2020-12-25 19:47:36 -06:00
{{ $ts.emailAddress }}
<template #desc v-if="$i.email && !$i.emailVerified">{{ $ts.verificationEmailSent }}</template>
<template #desc v-else-if="emailAddress === $i.email && $i.emailVerified">{{ $ts.emailVerified }}</template>
</FormInput>
</FormGroup>
2020-12-25 19:47:36 -06:00
<FormButton @click="save" primary>{{ $ts.save }}</FormButton>
</FormBase>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
2021-11-11 11:02:25 -06:00
import FormButton from '@/components/debobigego/button.vue';
import FormInput from '@/components/form/input.vue';
import FormBase from '@/components/debobigego/base.vue';
import FormGroup from '@/components/debobigego/group.vue';
import * as os from '@/os';
import * as symbols from '@/symbols';
export default defineComponent({
components: {
FormBase,
FormInput,
FormButton,
FormGroup,
},
emits: ['info'],
data() {
return {
2021-04-09 22:54:12 -05:00
[symbols.PAGE_INFO]: {
2020-12-25 19:47:36 -06:00
title: this.$ts.emailAddress,
2021-09-29 10:50:45 -05:00
icon: 'fas fa-envelope',
bg: 'var(--bg)',
},
emailAddress: null,
code: null,
}
},
created() {
this.emailAddress = this.$i.email;
},
mounted() {
2021-04-09 22:54:12 -05:00
this.$emit('info', this[symbols.PAGE_INFO]);
},
methods: {
save() {
os.dialog({
2020-12-25 19:47:36 -06:00
title: this.$ts.password,
input: {
type: 'password'
}
}).then(({ canceled, result: password }) => {
if (canceled) return;
2021-02-20 01:29:13 -06:00
os.apiWithDialog('i/update-email', {
password: password,
email: this.emailAddress,
});
});
}
}
});
</script>