diff --git a/pages/edit-otp.go.html b/pages/edit-otp.go.html index 6b067ac..c812558 100644 --- a/pages/edit-otp.go.html +++ b/pages/edit-otp.go.html @@ -17,7 +17,7 @@

Raw OTP string: {{.OtpUrl}}

- +
diff --git a/pages/edit-password.go.html b/pages/edit-password.go.html index e69de29..99e1cbc 100644 --- a/pages/edit-password.go.html +++ b/pages/edit-password.go.html @@ -0,0 +1,28 @@ + + + + {{.ServiceName}} + + +
+

{{.ServiceName}}

+
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ + diff --git a/pages/edit-username.go.html b/pages/edit-username.go.html deleted file mode 100644 index e69de29..0000000 diff --git a/pages/index.go.html b/pages/index.go.html index 737a71e..7852e1b 100644 --- a/pages/index.go.html +++ b/pages/index.go.html @@ -14,11 +14,6 @@ -
-
- -
-
@@ -34,14 +29,23 @@
-
-
- - - - -
-
+ {{if .OtpEnabled}} +
+
+ + +
+
+ {{else}} +
+
+ + + + +
+
+ {{end}}
diff --git a/pages/login-otp.go.html b/pages/login-otp.go.html index 5cc8d28..799c70e 100644 --- a/pages/login-otp.go.html +++ b/pages/login-otp.go.html @@ -12,7 +12,7 @@
- +
diff --git a/pages/verification-code.go.html b/pages/verification-code.go.html deleted file mode 100644 index c8ca642..0000000 --- a/pages/verification-code.go.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - {{.Title}} - - - -
-

{{.Title}}

-

Hi {{.Name}},

-

Here is your email verification code: {{.Code}}

-

{{.ServiceName}}

-
- - diff --git a/server/home.go b/server/home.go index 7ff3be5..362eeee 100644 --- a/server/home.go +++ b/server/home.go @@ -27,11 +27,16 @@ func (h *HttpServer) Home(rw http.ResponseWriter, req *http.Request, _ httproute } var userWithName *database.User + var hasTwoFactor bool if h.DbTx(rw, func(tx *database.Tx) (err error) { userWithName, err = tx.GetUserDisplayName(auth.Data.ID) if err != nil { return fmt.Errorf("failed to get user display name: %w", err) } + hasTwoFactor, err = tx.HasTwoFactor(auth.Data.ID) + if err != nil { + return fmt.Errorf("failed to get user two factor state: %w", err) + } return }) { return @@ -41,5 +46,6 @@ func (h *HttpServer) Home(rw http.ResponseWriter, req *http.Request, _ httproute "Auth": auth, "User": userWithName, "Nonce": lNonce, + "OtpEnabled": hasTwoFactor, }) }