Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix signin by e-mail creating two users (#152)

Guilherme Oenning065aa4391502
diff --git a/app/handlers/signup.go b/app/handlers/signup.go
index 1a3661cd7..059648fe4 100644
--- a/app/handlers/signup.go
+++ b/app/handlers/signup.go
@@ -81,11 +81,10 @@ func CreateTenant() web.HandlerFunc {
}
}
- if err := c.Services().Users.Register(user); err != nil {
- return c.Failure(err)
- }
-
if socialSignUp {
+ if err := c.Services().Users.Register(user); err != nil {
+ return c.Failure(err)
+ }
token, err := c.AddAuthCookie(user)
if err != nil {
return c.Failure(err)
diff --git a/app/handlers/signup_test.go b/app/handlers/signup_test.go
index 2d545bd50..f30127ff0 100644
--- a/app/handlers/signup_test.go
+++ b/app/handlers/signup_test.go
@@ -5,6 +5,7 @@ import (
"fmt"
+ "github.com/getfider/fider/app"
"github.com/getfider/fider/app/handlers"
"github.com/getfider/fider/app/models"
"github.com/getfider/fider/app/pkg/jwt"
@@ -133,8 +134,6 @@ func TestCreateTenantHandler_WithEmailAndName(t *testing.T) {
Expect(tenant.Status).To(Equal(models.TenantInactive))
user, err := services.Users.GetByEmail(tenant.ID, "[email protected]")
- Expect(err).To(BeNil())
- Expect(user.Name).To(Equal("Jon Snow"))
- Expect(user.Email).To(Equal("[email protected]"))
- Expect(user.Role).To(Equal(models.RoleAdministrator))
+ Expect(err).To(Equal(app.ErrNotFound))
+ Expect(user).To(BeNil())
}