refactor: consolidate authentication and DID handling logic

This commit is contained in:
Prad Nukala
2024-12-09 18:19:46 -05:00
parent ce3d073abd
commit f8d362352d
23 changed files with 144 additions and 217 deletions
+1 -1
View File
@@ -3,8 +3,8 @@ package handlers
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/common/response"
"github.com/onsonr/sonr/pkg/gateway/internal/pages/index"
"github.com/onsonr/sonr/pkg/gateway/internal/session"
"github.com/onsonr/sonr/pkg/gateway/pages/index"
)
func HandleIndex(c echo.Context) error {
+1 -11
View File
@@ -12,7 +12,7 @@ import (
"github.com/onsonr/sonr/pkg/blocks/forms"
"github.com/onsonr/sonr/pkg/common/response"
"github.com/onsonr/sonr/pkg/gateway/internal/database"
"github.com/onsonr/sonr/pkg/gateway/internal/pages/register"
"github.com/onsonr/sonr/pkg/gateway/pages/register"
)
func HandleRegisterView(c echo.Context) error {
@@ -24,16 +24,6 @@ func HandleRegisterView(c echo.Context) error {
}
func HandleRegisterStart(c echo.Context) error {
// Validate the form submission
formData := make(map[string][]string)
for key, values := range c.Request().Form {
formData[key] = values
}
if err := forms.ValidateCreateProfileForm(formData); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
}
challenge, _ := protocol.CreateChallenge()
handle := c.FormValue("handle")
firstName := c.FormValue("first_name")