UI resetpassword
This commit is contained in:
parent
3272fae13b
commit
4aa7a659a4
3 changed files with 59 additions and 44 deletions
|
|
@ -13,5 +13,6 @@ export default {
|
||||||
fileByFile: (name: string, group: string, id: string, fileName: string) =>
|
fileByFile: (name: string, group: string, id: string, fileName: string) =>
|
||||||
`${urlFile}/file/${name}/${group}/${id}/${fileName}`,
|
`${urlFile}/file/${name}/${group}/${id}/${fileName}`,
|
||||||
|
|
||||||
resetPassword:`${orgKeycloak}/user/change-password`
|
changePassword:`${orgKeycloak}/user/change-password`,
|
||||||
|
resetPassword:`${orgKeycloak}/user/reset-password`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ function closeDialog() {
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
showLoader()
|
showLoader()
|
||||||
await http
|
await http
|
||||||
.post(config.API.resetPassword, {
|
.post(config.API.changePassword, {
|
||||||
password: newPassword.value,
|
password: newPassword.value,
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import http from '@/plugins/http'
|
||||||
|
import config from '@/app.config'
|
||||||
|
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar'
|
||||||
import { useCounterMixin } from '@/stores/mixin'
|
import { useCounterMixin } from '@/stores/mixin'
|
||||||
|
|
@ -12,37 +15,27 @@ import env from '@/api/index'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const mixin = useCounterMixin()
|
const mixin = useCounterMixin()
|
||||||
const $q = useQuasar() //ใช้ noti quasar
|
const $q = useQuasar() //ใช้ noti quasar
|
||||||
|
const isReset = ref<boolean>(false)
|
||||||
const { showLoader, hideLoader } = mixin
|
const isFalse = ref<boolean>(false)
|
||||||
|
const { showLoader, hideLoader, messageError } = mixin
|
||||||
|
|
||||||
const username = ref<string>('')
|
const username = ref<string>('')
|
||||||
const password = ref<string>('')
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
showLoader()
|
showLoader()
|
||||||
const formdata = new URLSearchParams()
|
http
|
||||||
formdata.append('username', username.value)
|
.post(config.API.resetPassword, {
|
||||||
formdata.append('password', password.value)
|
username: username.value,
|
||||||
|
|
||||||
await axios
|
|
||||||
.post(`${env.API_URI}/org/login/checkin`, formdata, {
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then((res) => {
|
||||||
setAuthenCheckin(res.data.result)
|
if (res.data.result) {
|
||||||
|
isReset.value = true
|
||||||
|
isFalse.value = false
|
||||||
|
} else {
|
||||||
|
isFalse.value = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((e) => {
|
||||||
$q.dialog({
|
messageError($q, e)
|
||||||
component: CustomComponent,
|
|
||||||
componentProps: {
|
|
||||||
title: `ข้อความแจ้งเตือน`,
|
|
||||||
message: `${err.response.data.message}`,
|
|
||||||
icon: 'warning',
|
|
||||||
color: 'red',
|
|
||||||
onlycancel: true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader()
|
hideLoader()
|
||||||
|
|
@ -73,7 +66,15 @@ onMounted(async () => {})
|
||||||
@validation-success="onSubmit"
|
@validation-success="onSubmit"
|
||||||
style="max-width: 100%; min-width: 30%"
|
style="max-width: 100%; min-width: 30%"
|
||||||
>
|
>
|
||||||
<div class="row">
|
<q-banner
|
||||||
|
v-if="isFalse"
|
||||||
|
class="bg-amber-1 text-warning q-mb-sm"
|
||||||
|
style="border-top: 2px solid #f2c037; border-radius: 0 0 4px 4px"
|
||||||
|
>
|
||||||
|
<q-icon name="mdi-alert" size="sm" class="q-mr-xs"></q-icon
|
||||||
|
>ไม่พบชื่อผู้ใช้งานในระบบ
|
||||||
|
</q-banner>
|
||||||
|
<div class="row" v-if="!isReset">
|
||||||
<div class="col-12 q-mb-sm text-left">
|
<div class="col-12 q-mb-sm text-left">
|
||||||
<label
|
<label
|
||||||
for="username"
|
for="username"
|
||||||
|
|
@ -98,24 +99,37 @@ onMounted(async () => {})
|
||||||
type="submit"
|
type="submit"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 q-mb-xs">
|
</div>
|
||||||
<q-btn
|
|
||||||
unelevated
|
<q-banner class="bg-green-1 text-green q-mb-sm" rounded v-else>
|
||||||
outline
|
<q-icon name="mdi-check-circle" size="sm"></q-icon>คุณจะได้รับ
|
||||||
color="teal-5"
|
e-mail เพื่อเปลี่ยนรหัสผ่านใหม่
|
||||||
class="full-width"
|
</q-banner>
|
||||||
style="font-size: 16px; border-radius: 8px"
|
<div class="q-mb-xs">
|
||||||
@click="router.push(`/login`)"
|
<q-btn
|
||||||
><q-icon left name="mdi-chevron-left" />
|
unelevated
|
||||||
<div class="text-center">กลับไปที่การเข้าสู่ระบบ</div>
|
outline
|
||||||
</q-btn>
|
color="teal-5"
|
||||||
</div>
|
class="full-width"
|
||||||
<div class="text-left text-weight-medium">
|
style="font-size: 16px; border-radius: 8px"
|
||||||
ระบุชื่อผู้ใช้งานหรือที่อยู่อีเมลของคุณ
|
@click="router.push(`/login`)"
|
||||||
เราจะส่งคำแนะนำในการสร้างรหัสผ่านใหม่ให้คุณ
|
><q-icon left name="mdi-chevron-left" />
|
||||||
</div>
|
<div class="text-center">กลับไปที่การเข้าสู่ระบบ</div>
|
||||||
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</q-form>
|
||||||
|
<div
|
||||||
|
class="text-weight-medium bg-grey-3 text-center q-py-sm"
|
||||||
|
style="
|
||||||
|
border-radius: 0 0 10px 10px;
|
||||||
|
margin: 20px -40px -30px;
|
||||||
|
padding: 15px 35px;
|
||||||
|
font-size: 13px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
ป้อนชื่อผู้ใช้หรือที่อยู่อีเมลของคุณ
|
||||||
|
แล้วเราจะส่งคำแนะนำเกี่ยวกับวิธีสร้างรหัสผ่านใหม่ให้คุณ
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue