diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b2b1bca..005d900 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,12 +4,14 @@
-
-
+
-
-
-
+
+
+
+
+
+
@@ -147,7 +149,6 @@
-
@@ -172,7 +173,8 @@
-
+
+
true
diff --git a/pkg/internal/services/ticket.go b/pkg/internal/services/ticket.go
index e2b9c15..b9ecf68 100644
--- a/pkg/internal/services/ticket.go
+++ b/pkg/internal/services/ticket.go
@@ -12,22 +12,13 @@ import (
)
func DetectRisk(user models.Account, ip, ua string) bool {
- var availableFactor int64
- if err := database.C.
- Where(models.AuthFactor{AccountID: user.ID}).
- Where("type != ?", models.PasswordAuthFactor).
- Model(models.AuthFactor{}).
- Where(&availableFactor); err != nil || availableFactor <= 0 {
- return false
- }
-
- var secureFactor int64
+ var clue int64
if err := database.C.
Where(models.AuthTicket{AccountID: user.ID, IpAddress: ip}).
Where("available_at IS NOT NULL").
Model(models.AuthTicket{}).
- Count(&secureFactor).Error; err == nil {
- if secureFactor >= 1 {
+ Count(&clue).Error; err == nil {
+ if clue >= 1 {
return false
}
}
diff --git a/settings.toml b/settings.toml
index 5344981..8e6d066 100644
--- a/settings.toml
+++ b/settings.toml
@@ -1,4 +1,5 @@
id = "passport01"
+name = "Solarpass"
frontend_app = "web/dist"
diff --git a/web/src/components/UserMenu.vue b/web/src/components/UserMenu.vue
index 10a1c28..0786ed8 100755
--- a/web/src/components/UserMenu.vue
+++ b/web/src/components/UserMenu.vue
@@ -15,14 +15,16 @@
-
+
+
diff --git a/web/src/components/auth/FactorPicker.vue b/web/src/components/auth/FactorPicker.vue
index 151a587..dde94fd 100755
--- a/web/src/components/auth/FactorPicker.vue
+++ b/web/src/components/auth/FactorPicker.vue
@@ -44,11 +44,11 @@ const emits = defineEmits(["swap", "update:loading", "update:currentFactor"])
async function load() {
emits("update:loading", true)
- const res = await request(`/api/auth/factors?ticketId=${props.ticket.ticketId}`)
+ const res = await request(`/api/auth/factors?ticketId=${props.ticket.id}`)
if (res.status !== 200) {
error.value = await res.text()
} else {
- factors.value = await res.json()
+ factors.value = (await res.json()).filter((e: any) => e.type != 0)
}
emits("update:loading", false)
}
diff --git a/web/src/router/index.ts b/web/src/router/index.ts
index 5191ddb..388f706 100755
--- a/web/src/router/index.ts
+++ b/web/src/router/index.ts
@@ -8,6 +8,7 @@ const router = createRouter({
{
path: "/",
redirect: { name: "dashboard" },
+ meta: { public: true },
},
{
path: "/users",
diff --git a/web/src/stores/userinfo.ts b/web/src/stores/userinfo.ts
index 642e3f1..048b03f 100755
--- a/web/src/stores/userinfo.ts
+++ b/web/src/stores/userinfo.ts
@@ -9,7 +9,7 @@ export interface Userinfo {
data: any
}
-const defaultUserinfo: Userinfo = {
+export const defaultUserinfo: Userinfo = {
isLoggedIn: false,
displayName: "Citizen",
data: null,