From b84dca981f2dfb59853e0078f41d61496a72a493 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 16 Mar 2024 15:40:27 +0800 Subject: [PATCH] :sparkles: Account confirm --- pkg/services/tokens.go | 11 ++-- pkg/views/src/router/index.ts | 7 +++ pkg/views/src/views/confirm.vue | 104 ++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 pkg/views/src/views/confirm.vue diff --git a/pkg/services/tokens.go b/pkg/services/tokens.go index b050697..457fb77 100644 --- a/pkg/services/tokens.go +++ b/pkg/services/tokens.go @@ -1,13 +1,14 @@ package services import ( - "code.smartsheep.studio/hydrogen/identity/pkg/database" - "code.smartsheep.studio/hydrogen/identity/pkg/models" "fmt" - "github.com/google/uuid" - "github.com/spf13/viper" "strings" "time" + + "code.smartsheep.studio/hydrogen/identity/pkg/database" + "code.smartsheep.studio/hydrogen/identity/pkg/models" + "github.com/google/uuid" + "github.com/spf13/viper" ) const ConfirmRegistrationTemplate = `Dear %s, @@ -73,7 +74,7 @@ func NotifyMagicToken(token models.MagicToken) error { var content string switch token.Type { case models.ConfirmMagicToken: - link := fmt.Sprintf("https://%s/users/me/confirm?tk=%s", viper.GetString("domain"), token.Code) + link := fmt.Sprintf("https://%s/me/confirm?tk=%s", viper.GetString("domain"), token.Code) subject = fmt.Sprintf("[%s] Confirm your registration", viper.GetString("name")) content = fmt.Sprintf( ConfirmRegistrationTemplate, diff --git a/pkg/views/src/router/index.ts b/pkg/views/src/router/index.ts index c0981ee..f06410b 100644 --- a/pkg/views/src/router/index.ts +++ b/pkg/views/src/router/index.ts @@ -56,6 +56,13 @@ const router = createRouter({ name: "openid.connect", component: () => import("@/views/auth/connect.vue"), }, + + { + path: "/me/confirm", + name: "callback.confirm", + component: () => import("@/views/confirm.vue"), + meta: { public: true, title: "Confirm registration" }, + }, ], }, ], diff --git a/pkg/views/src/views/confirm.vue b/pkg/views/src/views/confirm.vue new file mode 100644 index 0000000..a8f0e0b --- /dev/null +++ b/pkg/views/src/views/confirm.vue @@ -0,0 +1,104 @@ + + + + +