fix
This commit is contained in:
@@ -4,13 +4,13 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/descrybe/descrybe-v2/apps/api/internal/auth"
|
||||
"github.com/descrybe/descrybe-v2/apps/api/internal/mail"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
@@ -37,7 +37,7 @@ func webOrigin() string {
|
||||
}
|
||||
|
||||
func setPasswordInviteURL(token string) string {
|
||||
return webOrigin() + "/accept-invite?token=" + url.QueryEscape(token)
|
||||
return mail.AcceptInviteURL(webOrigin(), token)
|
||||
}
|
||||
|
||||
// prepareSetPasswordHooks creates invites for active users with must_set_password=true.
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
func TestSetPasswordInviteURL(t *testing.T) {
|
||||
t.Setenv("WEB_ORIGIN", "https://app.example.com/")
|
||||
got := setPasswordInviteURL("tok+1")
|
||||
wantPrefix := "https://app.example.com/accept-invite?token="
|
||||
wantPrefix := "https://app.example.com/accept-invite#token="
|
||||
if !strings.HasPrefix(got, wantPrefix) {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
@@ -31,4 +31,4 @@ func TestWebOriginDefault(t *testing.T) {
|
||||
if webOrigin() != "http://localhost:5174" {
|
||||
t.Fatalf("default origin")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user