👽 Update to latest Passport version
This commit is contained in:
parent
010f8a065b
commit
7375c6a774
@ -1,11 +1,15 @@
|
||||
<template>
|
||||
<div class="flex items-center">
|
||||
<v-form class="flex-grow-1" @submit.prevent="submit">
|
||||
<v-text-field :label="t('username')" variant="solo" density="comfortable" class="mb-3" :hide-details="true"
|
||||
:disabled="props.loading" v-model="probe" />
|
||||
<v-text-field :label="t('password')" variant="solo" density="comfortable" type="password"
|
||||
:disabled="props.loading"
|
||||
v-model="password" />
|
||||
<v-text-field
|
||||
:label="t('username')"
|
||||
variant="solo"
|
||||
density="comfortable"
|
||||
class="mb-3"
|
||||
:hide-details="true"
|
||||
:disabled="props.loading"
|
||||
v-model="probe"
|
||||
/>
|
||||
|
||||
<v-expand-transition>
|
||||
<v-alert v-show="error" variant="tonal" type="error" class="text-xs mb-3">
|
||||
@ -36,7 +40,6 @@ const { t } = useI18n()
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const probe = ref("")
|
||||
const password = ref("")
|
||||
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
@ -44,13 +47,13 @@ const props = defineProps<{ loading?: boolean }>()
|
||||
const emits = defineEmits(["swap", "update:loading", "update:ticket"])
|
||||
|
||||
async function submit() {
|
||||
if (!probe.value || !password.value) return
|
||||
if (!probe.value) return
|
||||
|
||||
emits("update:loading", true)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username: probe.value, password: password.value }),
|
||||
body: JSON.stringify({ username: probe.value }),
|
||||
})
|
||||
if (res.status !== 200) {
|
||||
error.value = await res.text()
|
||||
|
@ -58,8 +58,8 @@ const emits = defineEmits(["swap", "update:ticket", "update:loading"])
|
||||
|
||||
async function submit() {
|
||||
emits("update:loading", true)
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth/mfa`, {
|
||||
method: "POST",
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/id/auth`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
ticket_id: props.ticket?.id,
|
||||
|
@ -48,7 +48,7 @@ async function load() {
|
||||
if (res.status !== 200) {
|
||||
error.value = await res.text()
|
||||
} else {
|
||||
factors.value = (await res.json()).filter((e: any) => e.type != 0)
|
||||
factors.value = await res.json()
|
||||
}
|
||||
emits("update:loading", false)
|
||||
}
|
||||
@ -76,13 +76,15 @@ async function submit() {
|
||||
|
||||
function getFactorType(item: any) {
|
||||
switch (item.type) {
|
||||
case 0:
|
||||
return { icon: "mdi-form-textbox-password", label: t("multiFactorTypePassword") }
|
||||
case 1:
|
||||
return { icon: "mdi-email-fast", label: t('multiFactorTypeEmail') }
|
||||
return { icon: "mdi-email-fast", label: t("multiFactorTypeEmail") }
|
||||
}
|
||||
}
|
||||
|
||||
function getFactorAvailable(factor: any) {
|
||||
const blacklist: number[] = props.ticket?.blacklist_factors ?? []
|
||||
const blacklist: number[] = props.ticket?.factor_trail ?? []
|
||||
return blacklist.includes(factor.id)
|
||||
}
|
||||
</script>
|
||||
|
@ -36,6 +36,7 @@
|
||||
"multiFactorCaption": "We need to verify that the person trying to access your account is you.",
|
||||
"multiFactorHint": "Check your inbox",
|
||||
"multiFactorTypeEmail": "Email One-time-password",
|
||||
"multiFactorTypePassword": "Password",
|
||||
"signInCompleted": "All Done",
|
||||
"signInCompletedCaption": "Welcome back! You just signed in right now! We're going to direct you to dashboard...",
|
||||
"authorizeTitle": "Connect to third-party",
|
||||
|
@ -36,6 +36,7 @@
|
||||
"multiFactorCaption": "我们需要验证试图访问您账户的人是您本人。",
|
||||
"multiFactorHint": "检查您的收件箱",
|
||||
"multiFactorTypeEmail": "电子邮件一次性密码",
|
||||
"multiFactorTypePassword": "账号密码",
|
||||
"signInCompleted": "完成",
|
||||
"signInCompletedCaption": "欢迎回来!您刚刚登录成功!我们将引导您进入仪表板...",
|
||||
"transferredToSolianHint": "此部分功能已转移到我们的应用程序 Solian,请下载或在浏览器中打开。如需了解更多信息,请访问项目描述页面。",
|
||||
|
16
package.json
16
package.json
@ -12,15 +12,15 @@
|
||||
"dependencies": {
|
||||
"@mdi/font": "^7.4.47",
|
||||
"@nuxt/content": "^2.13.2",
|
||||
"@nuxt/image": "^1.7.0",
|
||||
"@nuxtjs/i18n": "^8.3.3",
|
||||
"@nuxtjs/sitemap": "^6.0.0-beta.1",
|
||||
"@pinia/nuxt": "^0.5.3",
|
||||
"@nuxt/image": "^1.8.0",
|
||||
"@nuxtjs/i18n": "^8.5.3",
|
||||
"@nuxtjs/sitemap": "^6.0.1",
|
||||
"@pinia/nuxt": "^0.5.4",
|
||||
"feed": "^4.2.2",
|
||||
"nuxt": "^3.12.4",
|
||||
"nuxt": "^3.13.2",
|
||||
"nuxt-gtag": "^2.1.0",
|
||||
"nuxt-schema-org": "^3.3.9",
|
||||
"pinia": "^2.2.1",
|
||||
"nuxt-schema-org": "^3.4.0",
|
||||
"pinia": "^2.2.2",
|
||||
"rehype-sanitize": "^6.0.0",
|
||||
"rehype-stringify": "^10.0.0",
|
||||
"remark": "^15.0.1",
|
||||
@ -34,6 +34,6 @@
|
||||
"@unocss/preset-typography": "^0.61.9",
|
||||
"@unocss/reset": "^0.61.9",
|
||||
"vite-plugin-vuetify": "^2.0.4",
|
||||
"vuetify": "^3.6.14"
|
||||
"vuetify": "^3.7.1"
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,13 @@
|
||||
|
||||
<v-window :touch="false" :model-value="panel" class="pa-2 mx-[-0.5rem]">
|
||||
<v-window-item v-for="(k, idx) in Object.keys(panels)" :key="idx" :value="k">
|
||||
<component :is="panels[k]" @swap="(val: string) => (panel = val)" v-model:loading="loading"
|
||||
v-model:currentFactor="currentFactor" v-model:ticket="ticket" />
|
||||
<component
|
||||
:is="panels[k]"
|
||||
@swap="(val: string) => (panel = val)"
|
||||
v-model:loading="loading"
|
||||
v-model:currentFactor="currentFactor"
|
||||
v-model:ticket="ticket"
|
||||
/>
|
||||
</v-window-item>
|
||||
</v-window>
|
||||
</v-card-text>
|
||||
@ -33,12 +38,8 @@ import AuthenticateCompleted from "~/components/auth/AuthenticateCompleted.vue"
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
definePageMeta({
|
||||
alias: ["/auth/mfa"],
|
||||
})
|
||||
|
||||
useHead({
|
||||
title: t('signInTitle'),
|
||||
title: t("signInTitle"),
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
@ -66,17 +67,21 @@ onMounted(() => pickUpTicket())
|
||||
const id = useUserinfo()
|
||||
const router = useRouter()
|
||||
|
||||
watch(id, (value) => {
|
||||
if (value.isLoggedIn) {
|
||||
if (route.query["close"]) {
|
||||
window.close()
|
||||
} else if (route.query["redirect_uri"]) {
|
||||
window.open((route.query["redirect_uri"] as string) ?? "/", "_self")
|
||||
} else {
|
||||
router.push("/users/me")
|
||||
watch(
|
||||
id,
|
||||
(value) => {
|
||||
if (value.isLoggedIn) {
|
||||
if (route.query["close"]) {
|
||||
window.close()
|
||||
} else if (route.query["redirect_uri"]) {
|
||||
window.open((route.query["redirect_uri"] as string) ?? "/", "_self")
|
||||
} else {
|
||||
router.push("/users/me")
|
||||
}
|
||||
}
|
||||
}
|
||||
}, { deep: true, immediate: true })
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
)
|
||||
|
||||
const panel = ref("authenticate")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user