M accounts/input.go => accounts/input.go +2 -0
@@ 3,6 3,7 @@ package accounts
import (
"database/sql"
"fmt"
+ "strings"
"github.com/labstack/echo/v4"
"hg.code.netlandish.com/~netlandish/gobwebs"
@@ 92,6 93,7 @@ func (l *LoginEmailForm) Validate(c echo.Context) error {
if err := c.Validate(l); err != nil {
return err
}
+ l.Email = strings.ToLower(l.Email)
return nil
}
M accounts/routes.go => accounts/routes.go +3 -2
@@ 4,6 4,7 @@ import (
"database/sql"
"fmt"
"net/http"
+ "strings"
"time"
"github.com/labstack/echo/v4"
@@ 637,7 638,7 @@ func (s *Service) UpdateEmailPOST(c echo.Context) error {
WHERE "type"=$1
AND confirm_time IS NULL
AND expire_time AT TIME ZONE 'UTC' > NOW() AT TIME ZONE 'UTC'
- AND confirmation_target=$2
+ AND confirmation_target ILIKE $2
AND user_id != $3`,
EMAILCHCONF, form.Email, gctx.User.GetID())
if err := row.Scan(&pid); err != nil {
@@ 748,7 749,7 @@ func (s *Service) UpdateEmailConf(c echo.Context) error {
UPDATE "users"
SET email=$1
WHERE id=$2`,
- conf.ConfirmationTarget, conf.UserID)
+ strings.ToLower(conf.ConfirmationTarget.String), conf.UserID)
if err != nil {
return err
}