Update auth
This commit is contained in:
@@ -2,56 +2,42 @@
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<form class="login-form" @submit.prevent="onSubmit">
|
||||
<dx-form :form-data="formData" :disabled="loading">
|
||||
<dx-item
|
||||
data-field="email"
|
||||
editor-type="dxTextBox"
|
||||
:editor-options="{ stylingMode: 'filled', placeholder: 'Email', mode: 'email' }"
|
||||
>
|
||||
<dx-required-rule message="Dibutuhkan alamat email" />
|
||||
<dx-email-rule message="Alamat email tidak valid" />
|
||||
<dx-label :visible="false" />
|
||||
</dx-item>
|
||||
<dx-item
|
||||
data-field='password'
|
||||
editor-type='dxTextBox'
|
||||
:editor-options="{ stylingMode: 'filled', placeholder: 'Password', mode: 'password' }"
|
||||
>
|
||||
<dx-required-rule message="Password harus diisi" />
|
||||
<dx-label :visible="false" />
|
||||
</dx-item>
|
||||
<dx-item
|
||||
data-field="rememberMe"
|
||||
editor-type="dxCheckBox"
|
||||
:editor-options="{ text: 'Ingat saya', elementAttr: { class: 'form-text' } }"
|
||||
>
|
||||
<dx-label :visible="false" />
|
||||
</dx-item>
|
||||
<dx-button-item>
|
||||
<dx-button-options
|
||||
width="100%"
|
||||
type="default"
|
||||
template="signInTemplate"
|
||||
:use-submit-behavior="true"
|
||||
>
|
||||
</dx-button-options>
|
||||
</dx-button-item>
|
||||
<dx-item>
|
||||
<template #default>
|
||||
<div class="link">
|
||||
<router-link to="/reset-password">Lupa password?</router-link>
|
||||
</div>
|
||||
</template>
|
||||
</dx-item>
|
||||
<template #signInTemplate>
|
||||
<div>
|
||||
<span class="dx-button-text">
|
||||
<dx-load-indicator v-if="loading" width="24px" height="24px" :visible="true" />
|
||||
<span v-if="!loading">Log In</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</dx-form>
|
||||
<dx-form :form-data="formData" :disabled="loading">
|
||||
<dx-item data-field="email" editor-type="dxTextBox"
|
||||
:editor-options="{ stylingMode: 'filled', placeholder: 'Email', mode: 'email' }">
|
||||
<dx-required-rule message="Dibutuhkan alamat email" />
|
||||
<dx-email-rule message="Alamat email tidak valid" />
|
||||
<dx-label :visible="false" />
|
||||
</dx-item>
|
||||
<dx-item data-field='password' editor-type='dxTextBox'
|
||||
:editor-options="{ stylingMode: 'filled', placeholder: 'Password', mode: 'password' }">
|
||||
<dx-required-rule message="Password harus diisi" />
|
||||
<dx-label :visible="false" />
|
||||
</dx-item>
|
||||
<dx-item data-field="rememberMe" editor-type="dxCheckBox"
|
||||
:editor-options="{ text: 'Ingat saya', elementAttr: { class: 'form-text' } }">
|
||||
<dx-label :visible="false" />
|
||||
</dx-item>
|
||||
<dx-button-item>
|
||||
<dx-button-options width="100%" type="default" template="signInTemplate" :use-submit-behavior="true">
|
||||
</dx-button-options>
|
||||
</dx-button-item>
|
||||
<dx-item>
|
||||
<template #default>
|
||||
<div class="link">
|
||||
<router-link to="/reset-password">Lupa password?</router-link>
|
||||
</div>
|
||||
</template>
|
||||
</dx-item>
|
||||
<template #signInTemplate>
|
||||
<div>
|
||||
<span class="dx-button-text">
|
||||
<dx-load-indicator v-if="loading" width="24px" height="24px" :visible="true" />
|
||||
<span v-if="!loading">Log In</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</dx-form>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,8 +66,8 @@ export default {
|
||||
const router = useRouter();
|
||||
|
||||
const formData = reactive({
|
||||
email:"",
|
||||
password:""
|
||||
email: "",
|
||||
password: ""
|
||||
});
|
||||
const loading = ref(false);
|
||||
|
||||
@@ -93,11 +79,12 @@ export default {
|
||||
const { email, password } = formData;
|
||||
loading.value = true;
|
||||
const result = await auth.logIn(email, password);
|
||||
|
||||
if (!result.isOk) {
|
||||
loading.value = false;
|
||||
notify(result.message, "error", 2000);
|
||||
} else {
|
||||
router.push(route.query.redirect || "/home");
|
||||
router.push(route.query?.redirect || "/home");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,5 +128,8 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
html, body { height: 100%; }
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user