add changes from team review
Этот коммит содержится в:
@@ -377,6 +377,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
user = LoginByEmail(c, w, r, props["email"], props["name"], props["password"], props["device_id"])
|
||||
} else {
|
||||
c.Err = model.NewAppError("login", "Either user id or team name and user email must be provided", "")
|
||||
c.Err.StatusCode = http.StatusForbidden
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
},
|
||||
"SSOSettings": {
|
||||
"gitlab": {
|
||||
"Allow": true,
|
||||
"Secret" : "0495d3d6e528d91ba46605622a3645a8409ac5971ee287b1c3a6519fe27e6f6a",
|
||||
"Id": "87a4aeb746c67e87a54df78f6eccf85229dd30a3a797bfdb423b82ba4e749cd0",
|
||||
"AuthEndpoint": "http://dockerhost:8080/oauth/authorize",
|
||||
"TokenEndpoint": "http://dockerhost:8080/oauth/token",
|
||||
"UserApiEndpoint": "http://dockerhost:8080/api/v3/user"
|
||||
"Allow": false,
|
||||
"Secret" : "",
|
||||
"Id": "",
|
||||
"AuthEndpoint": "<yourgitlabdomain>/oauth/authorize",
|
||||
"TokenEndpoint": "<yourgitlabdomain>/oauth/token",
|
||||
"UserApiEndpoint": "<yourgitlabdomain>/api/v3/user"
|
||||
}
|
||||
},
|
||||
"SqlSettings": {
|
||||
|
||||
@@ -37,6 +37,7 @@ type User struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
AuthData string `json:"auth_data"`
|
||||
AuthService string `json:"auth_service"`
|
||||
Email string `json:"email"`
|
||||
EmailVerified bool `json:"email_verified"`
|
||||
Nickname string `json:"nickname"`
|
||||
@@ -50,7 +51,6 @@ type User struct {
|
||||
NotifyProps StringMap `json:"notify_props"`
|
||||
LastPasswordUpdate int64 `json:"last_password_update"`
|
||||
LastPictureUpdate int64 `json:"last_picture_update"`
|
||||
AuthService string `json:"auth_service"`
|
||||
}
|
||||
|
||||
type GitLabUser struct {
|
||||
|
||||
@@ -24,6 +24,7 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
|
||||
table.ColMap("Username").SetMaxSize(64)
|
||||
table.ColMap("Password").SetMaxSize(128)
|
||||
table.ColMap("AuthData").SetMaxSize(128)
|
||||
table.ColMap("AuthService").SetMaxSize(32)
|
||||
table.ColMap("Email").SetMaxSize(128)
|
||||
table.ColMap("Nickname").SetMaxSize(64)
|
||||
table.ColMap("FirstName").SetMaxSize(64)
|
||||
@@ -31,7 +32,6 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
|
||||
table.ColMap("Roles").SetMaxSize(64)
|
||||
table.ColMap("Props").SetMaxSize(4000)
|
||||
table.ColMap("NotifyProps").SetMaxSize(2000)
|
||||
table.ColMap("AuthService").SetMaxSize(32)
|
||||
table.SetUniqueTogether("Email", "TeamId")
|
||||
table.SetUniqueTogether("Username", "TeamId")
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (us SqlUserStore) UpgradeSchemaIfNeeded() {
|
||||
}
|
||||
}
|
||||
|
||||
us.CreateColumnIfNotExists("Users", "AuthService", "LastPictureUpdate", "varchar(32)", "") // for OAuth Client
|
||||
us.CreateColumnIfNotExists("Users", "AuthService", "AuthData", "varchar(32)", "") // for OAuth Client
|
||||
}
|
||||
|
||||
//func (ss SqlStore) CreateColumnIfNotExists(tableName string, columnName string, afterName string, colType string, defaultValue string) bool {
|
||||
|
||||
@@ -476,18 +476,18 @@ func signupWithOAuth(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
props := model.MapFromJson(strings.NewReader(data))
|
||||
|
||||
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.ServiceSettings.InviteSalt)) {
|
||||
c.Err = model.NewAppError("createUser", "The signup link does not appear to be valid", "")
|
||||
c.Err = model.NewAppError("signupWithOAuth", "The signup link does not appear to be valid", "")
|
||||
return
|
||||
}
|
||||
|
||||
t, err := strconv.ParseInt(props["time"], 10, 64)
|
||||
if err != nil || model.GetMillis()-t > 1000*60*60*48 { // 48 hours
|
||||
c.Err = model.NewAppError("createUser", "The signup link has expired", "")
|
||||
c.Err = model.NewAppError("signupWithOAuth", "The signup link has expired", "")
|
||||
return
|
||||
}
|
||||
|
||||
if team.Id != props["id"] {
|
||||
c.Err = model.NewAppError("createUser", "Invalid team name", data)
|
||||
c.Err = model.NewAppError("signupWithOAuth", "Invalid team name", data)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user