Open platform to collect and prioritize feedback
Better flow for the code based login
Matt Roberts9541f36cde62
diff --git a/app/actions/signin.go b/app/actions/signin.goindex 8836394d3..7b8f8ebde 100644--- a/app/actions/signin.go+++ b/app/actions/signin.go@@ -113,6 +113,66 @@ func (action *VerifySignInCode) Validate(ctx context.Context, user *entity.User)return result}+// SignInByEmailWithName happens when a new user (without account) requests to sign in by email+type SignInByEmailWithName struct {+ Email string `json:"email" format:"lower"`+ Name string `json:"name"`+ VerificationCode string+}++func NewSignInByEmailWithName() *SignInByEmailWithName {+ return &SignInByEmailWithName{+ VerificationCode: entity.GenerateEmailVerificationCode(),+ }+}++// IsAuthorized returns true if current user is authorized to perform this action+func (action *SignInByEmailWithName) IsAuthorized(ctx context.Context, user *entity.User) bool {+ tenant := ctx.Value(app.TenantCtxKey).(*entity.Tenant)+ // New users can only sign in if tenant allows email auth or is not private+ return tenant.IsEmailAuthAllowed || !tenant.IsPrivate+}++// Validate if current model is valid+func (action *SignInByEmailWithName) Validate(ctx context.Context, user *entity.User) *validate.Result {+ result := validate.Success()++ if action.Email == "" {+ result.AddFieldFailure("email", propertyIsRequired(ctx, "email"))+ } else {+ messages := validate.Email(ctx, action.Email)+ result.AddFieldFailure("email", messages...)+ }++ if action.Name == "" {+ result.AddFieldFailure("name", propertyIsRequired(ctx, "name"))+ } else if len(action.Name) > 100 {+ result.AddFieldFailure("name", propertyMaxStringLen(ctx, "name", 100))+ }++ return result+}++// GetEmail returns the email being verified+func (action *SignInByEmailWithName) GetEmail() string {+ return action.Email+}++// GetName returns the name provided by the user+func (action *SignInByEmailWithName) GetName() string {+ return action.Name+}++// GetUser returns the current user performing this action+func (action *SignInByEmailWithName) GetUser() *entity.User {+ return nil+}++// GetKind returns EmailVerificationKindSignIn+func (action *SignInByEmailWithName) GetKind() enum.EmailVerificationKind {+ return enum.EmailVerificationKindSignIn+}+// CompleteProfile happens when users completes their profile during first time sign intype CompleteProfile struct {Kind enum.EmailVerificationKind `json:"kind"`diff --git a/app/actions/signin_test.go b/app/actions/signin_test.goindex 90efad559..d7a5fde39 100644--- a/app/actions/signin_test.go+++ b/app/actions/signin_test.go@@ -105,3 +105,50 @@ func TestVerifySignInCode_ValidCodeAndEmail(t *testing.T) {result := action.Validate(context.Background(), nil)ExpectSuccess(result)}++func TestSignInByEmailWithName_EmptyEmailAndName(t *testing.T) {+ RegisterT(t)++ action := actions.SignInByEmailWithName{Email: "", Name: ""}+ result := action.Validate(context.Background(), nil)+ ExpectFailed(result, "email", "name")+}++func TestSignInByEmailWithName_InvalidEmail(t *testing.T) {+ RegisterT(t)++ action := actions.SignInByEmailWithName{Email: "invalid", Name: "Jon Snow"}+ result := action.Validate(context.Background(), nil)+ ExpectFailed(result, "email")+}++func TestSignInByEmailWithName_EmptyName(t *testing.T) {+ RegisterT(t)++ action := actions.SignInByEmailWithName{Email: "[email protected]", Name: ""}+ result := action.Validate(context.Background(), nil)+ ExpectFailed(result, "name")+}++func TestSignInByEmailWithName_LongName(t *testing.T) {+ RegisterT(t)++ // 101 characters+ longName := "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"+ action := actions.SignInByEmailWithName{Email: "[email protected]", Name: longName}+ result := action.Validate(context.Background(), nil)+ ExpectFailed(result, "name")+}++func TestSignInByEmailWithName_ValidEmailAndName(t *testing.T) {+ RegisterT(t)++ action := actions.NewSignInByEmailWithName()+ action.Email = "[email protected]"+ action.Name = "Jon Snow"++ result := action.Validate(context.Background(), nil)+ ExpectSuccess(result)+ Expect(action.VerificationCode).IsNotEmpty()+ Expect(len(action.VerificationCode)).Equals(6)+}diff --git a/app/cmd/routes.go b/app/cmd/routes.goindex 3de105b38..e315776f2 100644--- a/app/cmd/routes.go+++ b/app/cmd/routes.go@@ -124,6 +124,7 @@ func routes(r *web.Engine) *web.Engine {r.Get("/invite/verify", handlers.VerifySignInKey(enum.EmailVerificationKindUserInvitation))r.Post("/_api/signin/complete", handlers.CompleteSignInProfile())r.Post("/_api/signin", handlers.SignInByEmail())+ r.Post("/_api/signin/newuser", handlers.SignInByEmailWithName())r.Post("/_api/signin/verify", handlers.VerifySignInCode())r.Post("/_api/signin/resend", handlers.ResendSignInCode())diff --git a/app/handlers/signin.go b/app/handlers/signin.goindex cf7a88368..4ad1bb2f6 100644--- a/app/handlers/signin.go+++ b/app/handlers/signin.go@@ -71,7 +71,7 @@ func NotInvitedPage() web.HandlerFunc {}}-// SignInByEmail sends a new email with verification code+// SignInByEmail checks if user exists and sends code only for existing usersfunc SignInByEmail() web.HandlerFunc {return func(c *web.Context) error {action := actions.NewSignInByEmail()@@ -79,7 +79,56 @@ func SignInByEmail() web.HandlerFunc {return c.HandleValidation(result)}- err := bus.Dispatch(c, &cmd.SaveVerificationKey{+ // Check if user exists+ userByEmail := &query.GetUserByEmail{Email: action.Email}+ err := bus.Dispatch(c, userByEmail)+ userExists := err == nil++ // Only send code if user exists+ if userExists {+ err := bus.Dispatch(c, &cmd.SaveVerificationKey{+ Key: action.VerificationCode,+ Duration: 15 * time.Minute,+ Request: action,+ })+ if err != nil {+ return c.Failure(err)+ }++ c.Enqueue(tasks.SendSignInEmail(action.Email, action.VerificationCode))+ }++ return c.Ok(web.Map{+ "userExists": userExists,+ })+ }+}++// SignInByEmailWithName sends verification code for new users with their name+func SignInByEmailWithName() web.HandlerFunc {+ return func(c *web.Context) error {+ action := actions.NewSignInByEmailWithName()+ if result := c.BindTo(action); !result.Ok {+ return c.HandleValidation(result)+ }++ // Check that user doesn't already exist+ userByEmail := &query.GetUserByEmail{Email: action.Email}+ err := bus.Dispatch(c, userByEmail)+ if err == nil {+ // User already exists, should use regular sign in+ return c.BadRequest(web.Map{+ "email": "An account with this email already exists. Please sign in.",+ })+ }++ // Check if tenant is private (new users not allowed)+ if c.Tenant().IsPrivate {+ return c.Forbidden()+ }++ // Save verification with name+ err = bus.Dispatch(c, &cmd.SaveVerificationKey{Key: action.VerificationCode,Duration: 15 * time.Minute,Request: action,@@ -139,10 +188,36 @@ func VerifySignInCode() web.HandlerFunc {err = bus.Dispatch(c, userByEmail)if err != nil {if errors.Cause(err) == app.ErrNotFound {- // User doesn't exist, need to complete profile+ // User doesn't existif c.Tenant().IsPrivate {return c.Forbidden()}++ // If name is provided in verification, create user account+ if result.Name != "" {+ user := &entity.User{+ Name: result.Name,+ Email: result.Email,+ Tenant: c.Tenant(),+ Role: enum.RoleVisitor,+ }+ err = bus.Dispatch(c, &cmd.RegisterUser{User: user})+ if err != nil {+ return c.Failure(err)+ }++ // Mark code as verified+ err = bus.Dispatch(c, &cmd.SetKeyAsVerified{Key: action.Code})+ if err != nil {+ return c.Failure(err)+ }++ // Authenticate newly created user+ webutil.AddAuthUserCookie(c, user)+ return c.Ok(web.Map{})+ }++ // Name not provided - shouldn't happen with new flow, but handle legacy casereturn c.Ok(web.Map{"showProfileCompletion": true,})@@ -211,14 +286,27 @@ func VerifySignInKey(kind enum.EmailVerificationKind) web.HandlerFunc {return NotInvitedPage()(c)}- return c.Page(http.StatusOK, web.Props{- Page: "SignIn/CompleteSignInProfile.page",- Title: "Complete Sign In Profile",- Data: web.Map{- "kind": kind,- "k": key,- },- })+ // User should already have entered their name so we can get them registered.+ user := &entity.User{+ Name: result.Name,+ Email: result.Email,+ Tenant: c.Tenant(),+ Role: enum.RoleVisitor,+ }+ err = bus.Dispatch(c, &cmd.RegisterUser{User: user})+ if err != nil {+ return c.Failure(err)+ }++ err = bus.Dispatch(c, &cmd.SetKeyAsVerified{Key: key})+ if err != nil {+ return c.Failure(err)+ }++ webutil.AddAuthUserCookie(c, user)+ baseURL := c.BaseURL()+ return c.Redirect(baseURL)+}return c.Failure(err)}diff --git a/app/handlers/signin_test.go b/app/handlers/signin_test.goindex 01c508a70..88f1fcdd9 100644--- a/app/handlers/signin_test.go+++ b/app/handlers/signin_test.go@@ -34,7 +34,7 @@ func TestSignInByEmailHandler_WithoutEmail(t *testing.T) {Expect(code).Equals(http.StatusBadRequest)}-func TestSignInByEmailHandler_WithEmail(t *testing.T) {+func TestSignInByEmailHandler_ExistingUser(t *testing.T) {RegisterT(t)var saveKeyCmd *cmd.SaveVerificationKey@@ -43,8 +43,16 @@ func TestSignInByEmailHandler_WithEmail(t *testing.T) {return nil})+ bus.AddHandler(func(ctx context.Context, q *query.GetUserByEmail) error {+ if q.Email == "[email protected]" {+ q.Result = mock.JonSnow+ return nil+ }+ return app.ErrNotFound+ })+server := mock.NewServer()- code, _ := server.+ code, response := server.OnTenant(mock.DemoTenant).ExecutePost(handlers.SignInByEmail(), `{ "email": "[email protected]" }`)@@ -52,7 +60,90 @@ func TestSignInByEmailHandler_WithEmail(t *testing.T) {Expect(saveKeyCmd.Key).HasLen(6)Expect(saveKeyCmd.Request.GetKind()).Equals(enum.EmailVerificationKindSignIn)Expect(saveKeyCmd.Request.GetEmail()).Equals("[email protected]")- Expect(saveKeyCmd.Request.GetName()).Equals("")+ Expect(response.Body.String()).ContainsSubstring(`"userExists":true`)+}++func TestSignInByEmailHandler_NewUser(t *testing.T) {+ RegisterT(t)++ bus.AddHandler(func(ctx context.Context, q *query.GetUserByEmail) error {+ return app.ErrNotFound+ })++ server := mock.NewServer()+ code, response := server.+ OnTenant(mock.DemoTenant).+ ExecutePost(handlers.SignInByEmail(), `{ "email": "[email protected]" }`)++ Expect(code).Equals(http.StatusOK)+ Expect(response.Body.String()).ContainsSubstring(`"userExists":false`)+}++func TestSignInByEmailWithNameHandler_NewUser(t *testing.T) {+ RegisterT(t)++ var saveKeyCmd *cmd.SaveVerificationKey+ bus.AddHandler(func(ctx context.Context, c *cmd.SaveVerificationKey) error {+ saveKeyCmd = c+ return nil+ })++ bus.AddHandler(func(ctx context.Context, q *query.GetUserByEmail) error {+ return app.ErrNotFound+ })++ server := mock.NewServer()+ code, _ := server.+ OnTenant(mock.DemoTenant).+ ExecutePost(handlers.SignInByEmailWithName(), `{ "email": "[email protected]", "name": "New User" }`)++ Expect(code).Equals(http.StatusOK)+ Expect(saveKeyCmd.Key).HasLen(6)+ Expect(saveKeyCmd.Request.GetKind()).Equals(enum.EmailVerificationKindSignIn)+ Expect(saveKeyCmd.Request.GetEmail()).Equals("[email protected]")+ Expect(saveKeyCmd.Request.GetName()).Equals("New User")+}++func TestSignInByEmailWithNameHandler_ExistingUser(t *testing.T) {+ RegisterT(t)++ bus.AddHandler(func(ctx context.Context, q *query.GetUserByEmail) error {+ if q.Email == "[email protected]" {+ q.Result = mock.JonSnow+ return nil+ }+ return app.ErrNotFound+ })++ server := mock.NewServer()+ code, response := server.+ OnTenant(mock.DemoTenant).+ ExecutePost(handlers.SignInByEmailWithName(), `{ "email": "[email protected]", "name": "Jon Snow" }`)++ Expect(code).Equals(http.StatusBadRequest)+ Expect(response.Body.String()).ContainsSubstring("already exists")+}++func TestSignInByEmailWithNameHandler_PrivateTenant(t *testing.T) {+ RegisterT(t)++ bus.AddHandler(func(ctx context.Context, q *query.GetUserByEmail) error {+ return app.ErrNotFound+ })++ privateTenant := &entity.Tenant{+ ID: 1,+ Name: "Private Tenant",+ Subdomain: "private",+ IsPrivate: true,+ }++ server := mock.NewServer()+ code, _ := server.+ OnTenant(privateTenant).+ ExecutePost(handlers.SignInByEmailWithName(), `{ "email": "[email protected]", "name": "New User" }`)++ Expect(code).Equals(http.StatusForbidden)}func TestVerifySignInKeyHandler_UnknownKey(t *testing.T) {@@ -713,7 +804,7 @@ func TestVerifySignInCodeHandler_CorrectCode_ExistingUser(t *testing.T) {ExpectFiderAuthCookie(response, mock.JonSnow)}-func TestVerifySignInCodeHandler_CorrectCode_NewUser(t *testing.T) {+func TestVerifySignInCodeHandler_CorrectCode_NewUser_WithoutName(t *testing.T) {RegisterT(t)bus.AddHandler(func(ctx context.Context, q *query.GetVerificationByEmailAndCode) error {@@ -722,6 +813,7 @@ func TestVerifySignInCodeHandler_CorrectCode_NewUser(t *testing.T) {Key: "123456",CreatedAt: time.Now(),ExpiresAt: time.Now().Add(15 * time.Minute),+ Name: "", // No name stored (legacy flow)}return nil})@@ -739,6 +831,49 @@ func TestVerifySignInCodeHandler_CorrectCode_NewUser(t *testing.T) {Expect(response.Body.String()).ContainsSubstring(`"showProfileCompletion":true`)}+func TestVerifySignInCodeHandler_CorrectCode_NewUser_WithName(t *testing.T) {+ RegisterT(t)++ bus.AddHandler(func(ctx context.Context, q *query.GetVerificationByEmailAndCode) error {+ q.Result = &entity.EmailVerification{+ Email: "[email protected]",+ Key: "123456",+ CreatedAt: time.Now(),+ ExpiresAt: time.Now().Add(15 * time.Minute),+ Name: "New User", // Name stored (new flow)+ }+ return nil+ })++ bus.AddHandler(func(ctx context.Context, q *query.GetUserByEmail) error {+ return app.ErrNotFound+ })++ userRegistered := false+ var registeredUser *entity.User+ bus.AddHandler(func(ctx context.Context, c *cmd.RegisterUser) error {+ userRegistered = true+ registeredUser = c.User+ registeredUser.ID = 999+ return nil+ })++ bus.AddHandler(func(ctx context.Context, c *cmd.SetKeyAsVerified) error {+ return nil+ })++ server := mock.NewServer()+ code, response := server.+ OnTenant(mock.DemoTenant).+ ExecutePost(handlers.VerifySignInCode(), `{ "email": "[email protected]", "code": "123456" }`)++ Expect(code).Equals(http.StatusOK)+ Expect(userRegistered).IsTrue()+ Expect(registeredUser.Name).Equals("New User")+ Expect(registeredUser.Email).Equals("[email protected]")+ ExpectFiderAuthCookie(response, registeredUser)+}+func TestVerifySignInCodeHandler_CorrectCode_NewUser_PrivateTenant(t *testing.T) {RegisterT(t)diff --git a/e2e/features/ui/post.feature b/e2e/features/ui/post.featureindex 4344fdbd4..7a69abb88 100644--- a/e2e/features/ui/post.feature+++ b/e2e/features/ui/post.feature@@ -24,11 +24,11 @@ Feature: PostAnd I type "This is a draft post from a new user" as the descriptionAnd I type my email addressAnd I click continue with email- Then I should be on the confirmation link page- Given I click on the confirmation link- Then I should be on the complete profile page+ Then I should see the name fieldGiven I enter my name as "Matt"- And I click submit+ And I click continue+ Then I should be on the confirmation code page+ Given I enter the confirmation codeThen I should be on the home pageAnd I should see the new post modalAnd I should see "This is a draft post from a new user" as the draft post title\ No newline at end of filediff --git a/e2e/step_definitions/home.steps.ts b/e2e/step_definitions/home.steps.tsindex 3b3059701..e03eca7c0 100644--- a/e2e/step_definitions/home.steps.ts+++ b/e2e/step_definitions/home.steps.ts@@ -44,11 +44,30 @@ Given("I click continue with email", async function () {await this.page.click(".c-signin-control button[type='submit']")})+Then("I should see the name field", async function (this: FiderWorld) {+ // Wait for the name field to appear+ await this.page.waitForSelector("#input-name", { timeout: 5000 })+ const nameField = await this.page.locator("#input-name")+ await expect(nameField).toBeVisible()+})++Given("I click continue", async function () {+ await this.page.click("button[type='submit']")+})+Given("I click submit your feedback", async function () {await this.page.click(".c-share-feedback__content .c-button--primary")})-Given("I click on the confirmation link", async function (this: FiderWorld) {+Then("I should be on the confirmation code page", async function (this: FiderWorld) {+ const userEmail = `$user-${this.tenantName}@fider.io`+ // Wait for the code entry field to appear+ await this.page.waitForSelector("#input-code", { timeout: 5000 })+ // Check for code entry instruction message+ await expect(this.page.getByText(`Please type in the code we just sent to ${userEmail}`)).toBeVisible()+})++Given("I enter the confirmation code", async function (this: FiderWorld) {const userEmail = `$user-${this.tenantName}@fider.io`const code = await getLatestCodeSentTo(userEmail)@@ -60,11 +79,6 @@ Given("I click on the confirmation link", async function (this: FiderWorld) {await this.page.waitForLoadState("networkidle")})-Then("I should be on the complete profile page", async function (this: FiderWorld) {- const container = await this.page.$$("#p-complete-profile")- await expect(container).toBeDefined()-})-Then("I should see the new post modal", async function (this: FiderWorld) {const container = await this.page.getByTestId("modal")await expect(container).toBeVisible()@@ -78,12 +92,6 @@ Given("I click submit", async function () {await this.page.click("button[type='submit']")})-Then("I should be on the confirmation link page", async function (this: FiderWorld) {- const userEmail = `$user-${this.tenantName}@fider.io`- // Updated to check for code entry message instead of link message- await expect(this.page.getByText(`Please type in the code we just sent to ${userEmail}`)).toBeVisible()-})-Then("I should see {string} as the draft post title", async function (this: FiderWorld, title: string) {const postTitle = await this.page.locator("#input-title").inputValue()await expect(postTitle).toBe(title)diff --git a/locale/ar/client.json b/locale/ar/client.jsonindex e5d712839..e6733320f 100644--- a/locale/ar/client.json+++ b/locale/ar/client.json@@ -4,6 +4,7 @@"action.close": "إغلاق","action.commentsfeed": "تغذية التعليقات","action.confirm": "تأكيد",+ "action.continue": "","action.copylink": "نسخ الرابط","action.delete": "حذف","action.edit": "تعديل",@@ -217,6 +218,7 @@"signin.message.private.text": "إذا كان لديك حساب أو دعوت، فيمكنك استخدام الخيارات التالية لتسجيل الدخول.","signin.message.private.title": "<0>{0}</0> مساحة خاصة، يجب عليك تسجيل الدخول للمشاركة والتصويت.","signin.message.socialbutton.intro": "تسجيل الدخول بواسطة",+ "signin.name.placeholder": "","validation.custom.maxattachments": "يُسمح بحد أقصى {number} من المرفقات.","validation.custom.maximagesize": "يجب أن يكون حجم الصورة أصغر من {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, zero {}one {# وسم} two {# وسوم} few {# وسوم} many {# وسوم} other {# وسوم}}"diff --git a/locale/de/client.json b/locale/de/client.jsonindex 2270c769a..f03326c46 100644--- a/locale/de/client.json+++ b/locale/de/client.json@@ -4,6 +4,7 @@"action.close": "Schließen","action.commentsfeed": "Kommentar-Feed","action.confirm": "Bestätigen",+ "action.continue": "","action.copylink": "Link kopieren","action.delete": "Löschen","action.edit": "Bearbeiten",@@ -217,6 +218,7 @@"signin.message.private.text": "Wenn du ein Konto oder eine Einladung hast, kannst du folgende Optionen nutzen, um dich anzumelden.","signin.message.private.title": "<0>{0}</0> ist ein privater Raum, du musst dich anmelden, um teilzunehmen und abstimmen zu können.","signin.message.socialbutton.intro": "Einloggen mit",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Es sind maximal {number} Anhänge zulässig.","validation.custom.maximagesize": "Die Bildgröße muss kleiner als {kilobytes}KB sein.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# Tag} other {# Tags}}"diff --git a/locale/el/client.json b/locale/el/client.jsonindex 6cd91acc6..deeb85ea0 100644--- a/locale/el/client.json+++ b/locale/el/client.json@@ -4,6 +4,7 @@"action.close": "Κλείσιμο","action.commentsfeed": "Ροή σχολίων","action.confirm": "Επιβεβαίωση",+ "action.continue": "","action.copylink": "Αντιγραφή συνδέσμου","action.delete": "Διαγραφή","action.edit": "Επεξεργασία",@@ -217,6 +218,7 @@"signin.message.private.text": "Αν έχετε λογαριασμό ή πρόσκληση, μπορείτε να χρησιμοποιήσετε τις παρακάτω επιλογές για να συνδεθείτε.","signin.message.private.title": "<0>{0}</0> είναι ένας ιδιωτικός χώρος, πρέπει να συνδεθείτε για να συμμετάσχετε και να ψηφίσετε.","signin.message.socialbutton.intro": "Συνδεθείτε με",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Επιτρέπονται έως {number} συνημμένα.","validation.custom.maximagesize": "Το μέγεθος της εικόνας πρέπει να είναι μικρότερο από {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# ετικέτα} other {# ετικέτες}}"diff --git a/locale/en/client.json b/locale/en/client.jsonindex ca81b5b7c..9fecb8f4b 100644--- a/locale/en/client.json+++ b/locale/en/client.json@@ -4,6 +4,7 @@"action.close": "Close","action.commentsfeed": "Comment Feed","action.confirm": "Confirm",+ "action.continue": "Continue","action.copylink": "Copy link","action.delete": "Delete","action.edit": "Edit",@@ -13,6 +14,7 @@"action.respond": "Respond","action.save": "Save","action.signin": "Sign in",+ "action.signup": "Sign up","action.submit": "Submit","action.vote": "Vote for this idea","action.voted": "Voted!",@@ -218,6 +220,7 @@"signin.message.private.text": "If you have an account or an invitation, you may use following options to sign in.","signin.message.private.title": "<0>{0}</0> is a private space, you must sign in to participate and vote.","signin.message.socialbutton.intro": "Continue with",+ "signin.name.placeholder": "Your name","validation.custom.maxattachments": "A maximum of {number} attachments are allowed.","validation.custom.maximagesize": "The image size must be smaller than {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/es-ES/client.json b/locale/es-ES/client.jsonindex f67c46996..e87d9551a 100644--- a/locale/es-ES/client.json+++ b/locale/es-ES/client.json@@ -4,6 +4,7 @@"action.close": "Cerrar","action.commentsfeed": "Feed de comentarios","action.confirm": "Confirmar",+ "action.continue": "","action.copylink": "Copiar enlace","action.delete": "Eliminar","action.edit": "Editar",@@ -217,6 +218,7 @@"signin.message.private.text": "Si tienes una cuenta o una invitación, puedes usar las siguientes opciones para iniciar sesión.","signin.message.private.title": "<0>{0}</0> es un espacio privado, debes iniciar sesión para participar y votar.","signin.message.socialbutton.intro": "Iniciar sesión con",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Se permite un máximo de {number} archivos adjuntos.","validation.custom.maximagesize": "El tamaño de la imagen debe ser menor que {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# etiqueta} other {# etiquetas}}"diff --git a/locale/fa/client.json b/locale/fa/client.jsonindex cd32c55fb..c00703d2d 100644--- a/locale/fa/client.json+++ b/locale/fa/client.json@@ -4,6 +4,7 @@"action.close": "بستن","action.commentsfeed": "فید نظرات","action.confirm": "تأیید",+ "action.continue": "","action.copylink": "کپی لینک","action.delete": "حذف","action.edit": "ویرایش",@@ -217,6 +218,7 @@"signin.message.private.text": "اگر حساب یا دعوتنامه دارید، از گزینههای زیر برای ورود استفاده کنید.","signin.message.private.title": "<0>{0}</0> یک فضای خصوصی است؛ برای مشارکت باید وارد شوید.","signin.message.socialbutton.intro": "ورود با",+ "signin.name.placeholder": "","validation.custom.maxattachments": "حداکثر تعداد {number} پیوست مجاز است.","validation.custom.maximagesize": "حجم تصویر باید کمتر از {kilobytes}KB باشد.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# برچسب} other {# برچسب}}"diff --git a/locale/fr/client.json b/locale/fr/client.jsonindex 4485c5d6d..b971a41ab 100644--- a/locale/fr/client.json+++ b/locale/fr/client.json@@ -4,6 +4,7 @@"action.close": "Fermer","action.commentsfeed": "Flux de commentaires","action.confirm": "Confirmer",+ "action.continue": "","action.copylink": "Copier le lien","action.delete": "Supprimer","action.edit": "Modifier",@@ -217,6 +218,7 @@"signin.message.private.text": "Si vous avez un compte ou une invitation, vous pouvez utiliser les options suivantes pour vous connecter.","signin.message.private.title": "<0>{0}</0> est un espace privé, vous devez vous connecter pour participer et voter.","signin.message.socialbutton.intro": "Se connecter avec",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Un maximum de {number} pièces jointes est autorisé.","validation.custom.maximagesize": "La taille de l'image doit être inférieure à {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/it/client.json b/locale/it/client.jsonindex a625e586b..2c998ad41 100644--- a/locale/it/client.json+++ b/locale/it/client.json@@ -4,6 +4,7 @@"action.close": "Chiudi","action.commentsfeed": "Feed dei commenti","action.confirm": "Conferma",+ "action.continue": "","action.copylink": "Copia il collegamento","action.delete": "Cancella","action.edit": "Modifica",@@ -217,6 +218,8 @@"signin.message.private.text": "Se si dispone di un account o di un invito, è possibile utilizzare le seguenti opzioni per accedere.","signin.message.private.title": "<0>{0}</0> è uno spazio privato, è necessario registrarsi per partecipare e votare.","signin.message.socialbutton.intro": "Accedi con",+ "+ "signin.name.placeholder": "","validation.custom.maxattachments": "Sono consentiti al massimo {number} allegati.","validation.custom.maximagesize": "La dimensione dell'immagine deve essere inferiore a {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/ja/client.json b/locale/ja/client.jsonindex 91bc31451..b8635ab28 100644--- a/locale/ja/client.json+++ b/locale/ja/client.json@@ -4,6 +4,7 @@"action.close": "閉じる","action.commentsfeed": "コメントフィード","action.confirm": "確認",+ "action.continue": "","action.copylink": "リンクをコピー","action.delete": "削除","action.edit": "編集",@@ -217,6 +218,7 @@"signin.message.private.text": "アカウントや招待状をお持ちの場合は、以下のオプションを使用してサインインできます。","signin.message.private.title": "<0>{0}</0> はプライベートなスペースです。サインインして投票してください。","signin.message.socialbutton.intro": "ログイン",+ "signin.name.placeholder": "","validation.custom.maxattachments": "最大 {number} 個の添付ファイルが許可されます。","validation.custom.maximagesize": "画像サイズは{kilobytes}KB未満である必要があります。","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/nl/client.json b/locale/nl/client.jsonindex 4b0852a88..327aeb96d 100644--- a/locale/nl/client.json+++ b/locale/nl/client.json@@ -4,6 +4,7 @@"action.close": "Sluiten","action.commentsfeed": "Reactiefeed","action.confirm": "Bevestigen",+ "action.continue": "","action.copylink": "Link kopiëren","action.delete": "Verwijderen","action.edit": "Bewerken",@@ -217,6 +218,7 @@"signin.message.private.text": "Als je een account of een uitnodiging hebt, kun je de volgende methodes gebruiken om in te loggen.","signin.message.private.title": "<0>{0}</0> is een privéruimte. U moet ingelogd zijn om deel te nemen en te stemmen.","signin.message.socialbutton.intro": "Inloggen met",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Er zijn maximaal {number} bijlagen toegestaan.","validation.custom.maximagesize": "De afbeeldingsgrootte moet kleiner zijn dan {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/pl/client.json b/locale/pl/client.jsonindex e27c791a7..1ea0df213 100644--- a/locale/pl/client.json+++ b/locale/pl/client.json@@ -4,6 +4,7 @@"action.close": "Zamknij","action.commentsfeed": "Kanał komentarzy","action.confirm": "Potwierdź",+ "action.continue": "","action.copylink": "Kopiuj link","action.delete": "Usuń","action.edit": "Edytuj",@@ -217,6 +218,7 @@"signin.message.private.text": "Jeśli posiadasz konto lub zaproszenie możesz użyć poniższych opcji aby się zalogować.","signin.message.private.title": "<0>{0}</0> to przestrzeń prywatna, musisz się zalogować, aby uczestniczyć i głosować.","signin.message.socialbutton.intro": "Zaloguj się za pomocą",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Maksymalna liczba załączników to {number}.","validation.custom.maximagesize": "Rozmiar obrazu musi być mniejszy niż {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} few {# tagów} many {# tagów} other {# tagi}}"diff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.jsonindex dd70260b9..a8440a802 100644--- a/locale/pt-BR/client.json+++ b/locale/pt-BR/client.json@@ -4,6 +4,7 @@"action.close": "Fechar","action.commentsfeed": "Feed de comentários","action.confirm": "Confirmar",+ "action.continue": "","action.copylink": "Copiar link","action.delete": "Deletar","action.edit": "Editar",@@ -217,6 +218,7 @@"signin.message.private.text": "Se você tem uma conta ou um convite, você pode usar as seguintes opções para fazer o login.","signin.message.private.title": "<0>{0}</0> é um espaço privado, você deve se inscrever para participar e votar.","signin.message.socialbutton.intro": "Fazer login com",+ "signin.name.placeholder": "","validation.custom.maxattachments": "São permitidos no máximo {number} anexos.","validation.custom.maximagesize": "O tamanho da imagem deve ser menor que {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/ru/client.json b/locale/ru/client.jsonindex 383718415..6bd38280f 100644--- a/locale/ru/client.json+++ b/locale/ru/client.json@@ -4,6 +4,7 @@"action.close": "Закрыть","action.commentsfeed": "Лента комментариев","action.confirm": "Подтвердить",+ "action.continue": "","action.copylink": "Копировать ссылку","action.delete": "Удалить","action.edit": "Изменить",@@ -217,6 +218,7 @@"signin.message.private.text": "Если у вас есть аккаунт или приглашение, вы можете использовать их для входа.","signin.message.private.title": "<0>{0}</0> является приватным пространством, вы должны войти в систему, чтобы принять участие и проголосовать.","signin.message.socialbutton.intro": "Войти с помощью",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Разрешено максимум {number} вложений.","validation.custom.maximagesize": "Размер изображения должен быть меньше {kilobytes}КБ.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/sk/client.json b/locale/sk/client.jsonindex 1ad731433..33572a28d 100644--- a/locale/sk/client.json+++ b/locale/sk/client.json@@ -4,6 +4,7 @@"action.close": "Zavrieť","action.commentsfeed": "Kanál komentárov","action.confirm": "Potvrdiť",+ "action.continue": "","action.copylink": "Kopírovať odkaz","action.delete": "Vymazať","action.edit": "Upraviť",@@ -217,6 +218,8 @@"signin.message.private.text": "Ak máte účet alebo pozvánku, na prihlásenie môžete použiť nasledujúce možnosti.","signin.message.private.title": "<0>{0}</0> je súkromný priestor, ak sa chcete zúčastniť diskusie a hlasovať, musíte sa prihlásiť.","signin.message.socialbutton.intro": "Prihlásiť sa pomocou",+ "+ "signin.name.placeholder": "","validation.custom.maxattachments": "Maximálny počet príloh je {number}.","validation.custom.maximagesize": "Veľkosť obrázka musí byť menšia ako {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/locale/sv-SE/client.json b/locale/sv-SE/client.jsonindex bb30c2c8d..16c827cdc 100644--- a/locale/sv-SE/client.json+++ b/locale/sv-SE/client.json@@ -4,6 +4,7 @@"action.close": "Stäng","action.commentsfeed": "Kommentarflöde","action.confirm": "Bekräfta",+ "action.continue": "","action.copylink": "Kopiera länk","action.delete": "Radera","action.edit": "Ändra",@@ -217,6 +218,7 @@"signin.message.private.text": "Om du har ett konto eller en inbjudan kan du använda följande alternativ för att logga in.","signin.message.private.title": "<0>{0}</0> är ett privat utrymme, du måste logga in för att delta och rösta.","signin.message.socialbutton.intro": "Logga in med",+ "signin.name.placeholder": "","validation.custom.maxattachments": "Maximalt {number} bilagor är tillåtna.","validation.custom.maximagesize": "Bildstorleken måste vara mindre än {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, =1 {# etikett} other {# etiketter}}"diff --git a/locale/tr/client.json b/locale/tr/client.jsonindex e7a18cbf6..c3e0fe467 100644--- a/locale/tr/client.json+++ b/locale/tr/client.json@@ -4,6 +4,7 @@"action.close": "Kapat","action.commentsfeed": "Yorum Beslemesi","action.confirm": "Onayla",+ "action.continue": "","action.copylink": "Bağlantıyı kopyala","action.delete": "Sil","action.edit": "Düzenle",@@ -217,6 +218,7 @@"signin.message.private.text": "Eğer bir hesabınız ya da davetiyeniz varsa aşağıdaki seçenekleri kullanarak giriş yapabilirsiniz.","signin.message.private.title": "<0>{0}</0> özel bir alandır ve katılabilmek için davetiye almanız gerekir.","signin.message.socialbutton.intro": "İle giriş yapın",+ "signin.name.placeholder": "","validation.custom.maxattachments": "En fazla {number} ek dosyaya izin verilir.","validation.custom.maximagesize": "Resim boyutu {kilobytes}KB'den küçük olmalıdır.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# etiket} other {# etiket}}"diff --git a/locale/zh-CN/client.json b/locale/zh-CN/client.jsonindex 712c9bc23..30f96f080 100644--- a/locale/zh-CN/client.json+++ b/locale/zh-CN/client.json@@ -4,6 +4,7 @@"action.close": "关闭","action.commentsfeed": "评论提要","action.confirm": "确认",+ "action.continue": "","action.copylink": "复制链接","action.delete": "删除","action.edit": "编辑",@@ -217,6 +218,7 @@"signin.message.private.text": "如果您有帐户或邀请,您可以使用以下选项登录.","signin.message.private.title": "<0>{0}</0> 这是一个私人空间,您必须登录才能参与和投票.","signin.message.socialbutton.intro": "使用以下方式登录",+ "signin.name.placeholder": "","validation.custom.maxattachments": "最多允许 {number} 个附件。","validation.custom.maximagesize": "图像大小必须小于{kilobytes}KB。","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"diff --git a/public/components/SignInModal.tsx b/public/components/SignInModal.tsxindex 31aec720c..c27a65718 100644--- a/public/components/SignInModal.tsx+++ b/public/components/SignInModal.tsx@@ -10,15 +10,10 @@ interface SignInModalProps {}export const SignInModal: React.FC<SignInModalProps> = (props) => {- const onCodeVerified = (result: { showProfileCompletion?: boolean; code?: string }): void => {- if (result.showProfileCompletion && result.code) {- // User needs to complete profile - redirect to profile completion page- location.href = `/signin/complete?code=${encodeURIComponent(result.code)}`- } else {- // User is authenticated - close modal and reload to refresh the page- props.onClose()- location.reload()- }+ const onCodeVerified = (): void => {+ // User is authenticated - close modal and reload to refresh the page+ props.onClose()+ location.reload()}return (diff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsxindex ead9ae109..894e458e7 100644--- a/public/components/common/SignInControl.tsx+++ b/public/components/common/SignInControl.tsx@@ -14,20 +14,25 @@ interface SignInControlProps {onSubmit?: () => voidonEmailSent?: (email: string) => voidsignInButtonText?: string- onCodeVerified?: (result: { showProfileCompletion?: boolean; code?: string }) => void+ onCodeVerified?: () => void+}++enum EmailSigninStep {+ EnterEmail,+ EnterName,+ EnterCode,}export const SignInControl: React.FunctionComponent<SignInControlProps> = (props) => {const fider = useFider()const [showEmailForm, setShowEmailForm] = useState(fider.session.tenant ? fider.session.tenant.isEmailAuthAllowed : true)- const [showCodeEntry, setShowCodeEntry] = useState(false)const [email, setEmail] = useState("")+ const [emailSignInStep, setEmailSignInStep] = useState(EmailSigninStep.EnterEmail)+ const [userName, setUserName] = useState("")const [code, setCode] = useState("")const [error, setError] = useState<Failure | undefined>(undefined)const [resendMessage, setResendMessage] = useState("")- const signInText = props.signInButtonText || i18n._({ id: "action.signin", message: "Sign in" })-const forceShowEmailForm = (e: React.MouseEvent<HTMLAnchorElement>) => {e.preventDefault()setShowEmailForm(true)@@ -44,7 +49,8 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props}const editEmail = () => {- setShowCodeEntry(false)+ setEmailSignInStep(EmailSigninStep.EnterEmail)+ setUserName("")setCode("")setError(undefined)setResendMessage("")@@ -55,8 +61,25 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (propsconst result = await actions.signIn(email)if (result.ok) {setError(undefined)- setShowCodeEntry(true)- // Don't call onEmailSent - we're showing code entry inline now+ const data = result.data as { userExists?: boolean } | undefined+ if (data && data.userExists === false) {+ // New user - show name field+ setEmailSignInStep(EmailSigninStep.EnterName)+ } else {+ // Existing user - show code entry+ setEmailSignInStep(EmailSigninStep.EnterCode)+ }+ } else if (result.error) {+ setError(result.error)+ }+ }++ const submitNewUser = async () => {+ doPreSigninAction()+ const result = await actions.signInNewUser(email, userName)+ if (result.ok) {+ setError(undefined)+ setEmailSignInStep(EmailSigninStep.EnterCode)} else if (result.error) {setError(result.error)}@@ -65,10 +88,9 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (propsconst verifyCode = async () => {const result = await actions.verifySignInCode(email, code)if (result.ok) {- const data = result.data as { showProfileCompletion?: boolean } | undefinedif (props.onCodeVerified) {- // Let the parent component decide what to do, pass the code along- props.onCodeVerified({ ...data, code })+ // Let the parent component decide what to do+ props.onCodeVerified()} else {// Default behavior: reload the pagelocation.reload()@@ -103,6 +125,30 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (propsconst providersLen = fider.settings.oauth.length+ const renderSigninEmailButton = () => {+ if (emailSignInStep == EmailSigninStep.EnterEmail) {+ return (+ <Button className="w-full justify-center" type="submit" variant="primary" onClick={signIn}>+ <Trans id="signin.message.email">Continue with Email</Trans>+ </Button>+ )+ }+ if (emailSignInStep == EmailSigninStep.EnterName) {+ return (+ <Button className="w-full justify-center" type="submit" variant="primary" onClick={submitNewUser}>+ <Trans id="action.signup">Sign up</Trans>+ </Button>+ )+ }+ if (emailSignInStep == EmailSigninStep.EnterCode) {+ return (+ <Button className="w-full justify-center" type="submit" variant="primary" disabled={code.length !== 6} onClick={verifyCode}>+ <Trans id="action.submit">Submit</Trans>+ </Button>+ )+ }+ }+if (!isCookieEnabled()) {return (<Message type="error">@@ -130,71 +176,15 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props{props.useEmail &&(showEmailForm ? (<div className="pt-3">- {!showCodeEntry ? (- <Form error={error}>- <Input- className="text-left"- field="email"- value={email}- autoFocus={!device.isTouch()}- onChange={setEmail}- placeholder={i18n._({ id: "signin.email.placeholder", message: "Email address" })}- />- <Button className="w-full justify-center" type="submit" variant="primary" disabled={email === ""} onClick={signIn}>- {signInText}- </Button>- {!fider.session.tenant.isEmailAuthAllowed && (- <p className="text-red-700 mt-1">- <Trans id="signin.message.onlyadmins">Currently only allowed to sign in to an administrator account</Trans>- </p>- )}- </Form>- ) : (- <div>- <p className="text-muted mb-2">- <Trans id="signin.code.instruction">- Please type in the code we just sent to <strong>{email}</strong>- </Trans>{" "}- <a- href="#"- className="text-link"- onClick={(e) => {- e.preventDefault()- editEmail()- }}- >- <Trans id="signin.code.edit">Edit</Trans>- </a>- </p>- <Form error={error}>- <Input- className="text-left"- field="code"- value={code}- autoFocus={!device.isTouch()}- onChange={setCode}- placeholder={i18n._({ id: "signin.code.placeholder", message: "Type in the code here" })}- maxLength={6}- />- <Button className="w-full justify-center" type="submit" variant="primary" disabled={code.length !== 6} onClick={verifyCode}>- <Trans id="signin.code.submit">Submit</Trans>- </Button>- </Form>- {resendMessage && <p className="text-green-700 mt-2">{resendMessage}</p>}- <p className="text-center mt-2">- <a- href="#"- className="text-link"- onClick={(e) => {- e.preventDefault()- resendCode()- }}- >- <Trans id="signin.code.getnew">Get a new code</Trans>- </a>- </p>- </div>- )}+ <Form error={error}>+ {(emailSignInStep == EmailSigninStep.EnterEmail || emailSignInStep == EmailSigninStep.EnterName) && renderEmailField()}++ {emailSignInStep == EmailSigninStep.EnterName && renderNameField()}++ {emailSignInStep == EmailSigninStep.EnterCode && renderCodeField()}++ <div className="pt-3">{renderSigninEmailButton()}</div>+ </Form></div>) : (<div>@@ -211,4 +201,85 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props))}</div>)++ function renderNameField() {+ return (+ <Input+ className="text-left"+ field="name"+ value={userName}+ autoFocus={!device.isTouch()}+ onChange={setUserName}+ placeholder={i18n._({ id: "signin.name.placeholder", message: "Your name" })}+ maxLength={100}+ />+ )+ }++ function renderEmailField(): React.ReactNode {+ return (+ <>+ <Input+ className="text-left"+ field="email"+ value={email}+ disabled={emailSignInStep == EmailSigninStep.EnterName}+ autoFocus={!device.isTouch()}+ onChange={setEmail}+ placeholder={i18n._({ id: "signin.email.placeholder", message: "Email address" })}+ />+ {!fider.session.tenant.isEmailAuthAllowed && (+ <p className="text-red-700 mt-1">+ <Trans id="signin.message.onlyadmins">Currently only allowed to sign in to an administrator account</Trans>+ </p>+ )}+ </>+ )+ }++ function renderCodeField(): React.ReactNode {+ return (+ <>+ <p className="text-muted mb-2">+ <Trans id="signin.code.instruction">+ Please type in the code we just sent to <strong>{email}</strong>+ </Trans>{" "}+ <a+ href="#"+ className="text-link"+ onClick={(e) => {+ e.preventDefault()+ editEmail()+ }}+ >+ <Trans id="signin.code.edit">Edit</Trans>+ </a>+ </p>+ <Form error={error}>+ <Input+ className="text-left"+ field="code"+ value={code}+ autoFocus={!device.isTouch()}+ onChange={setCode}+ placeholder={i18n._({ id: "signin.code.placeholder", message: "Type in the code here" })}+ maxLength={6}+ />+ </Form>+ {resendMessage && <p className="text-green-700 mt-2">{resendMessage}</p>}+ <p className="text-center mt-2">+ <a+ href="#"+ className="text-link"+ onClick={(e) => {+ e.preventDefault()+ resendCode()+ }}+ >+ <Trans id="signin.code.getnew">Get a new code</Trans>+ </a>+ </p>+ </>+ )+ }}diff --git a/public/pages/Home/components/ShareFeedback.tsx b/public/pages/Home/components/ShareFeedback.tsxindex 37e11c186..c13ae6314 100644--- a/public/pages/Home/components/ShareFeedback.tsx+++ b/public/pages/Home/components/ShareFeedback.tsx@@ -200,15 +200,9 @@ export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {}}- const onCodeVerified = (result: { showProfileCompletion?: boolean; code?: string }): void => {- if (result.showProfileCompletion && result.code) {- // User needs to complete profile - redirect to profile completion page- // The cached feedback will be preserved for after profile setup- location.href = `/signin/complete?code=${encodeURIComponent(result.code)}`- } else {- // User is authenticated - finalize the feedback submission- finaliseFeedback()- }+ const onCodeVerified = (): void => {+ // User is authenticated - finalize the feedback submission+ finaliseFeedback()}const handleEditorFocus = () => {diff --git a/public/pages/SignIn/SignIn.page.tsx b/public/pages/SignIn/SignIn.page.tsxindex e13fdc711..6b54aa784 100644--- a/public/pages/SignIn/SignIn.page.tsx+++ b/public/pages/SignIn/SignIn.page.tsx@@ -34,18 +34,13 @@ const Private = (): JSX.Element => {export const SignInPage = () => {const fider = useFider()- const onCodeVerified = (result: { showProfileCompletion?: boolean; code?: string }) => {- if (result.showProfileCompletion && result.code) {- // User needs to complete profile - redirect to profile completion page- location.href = `/signin/complete?code=${encodeURIComponent(result.code)}`+ const onCodeVerified = () => {+ // User is authenticated - redirect to the appropriate URL+ const redirect = new URLSearchParams(window.location.search).get("redirect")+ if (redirect && redirect.startsWith("/")) {+ location.href = fider.settings.baseURL + redirect} else {- // User is authenticated - redirect to the appropriate URL- const redirect = new URLSearchParams(window.location.search).get("redirect")- if (redirect && redirect.startsWith("/")) {- location.href = fider.settings.baseURL + redirect- } else {- location.href = fider.settings.baseURL- }+ location.href = fider.settings.baseURL}}diff --git a/public/services/actions/tenant.ts b/public/services/actions/tenant.tsindex fbbbf3578..58e5d62d9 100644--- a/public/services/actions/tenant.ts+++ b/public/services/actions/tenant.ts@@ -58,6 +58,10 @@ export const signIn = async (email: string): Promise<Result> => {return await http.post("/_api/signin", { email })}+export const signInNewUser = async (email: string, name: string): Promise<Result> => {+ return await http.post("/_api/signin/newuser", { email, name })+}+export const verifySignInCode = async (email: string, code: string): Promise<Result> => {return await http.post("/_api/signin/verify", { email, code })}