коммит произвёл
GitHub
родитель
b45ff0be5d
Коммит
717a4d04a9
@@ -44,7 +44,7 @@ func (a *App) GetCloudSession(token string) (*model.Session, *model.AppError) {
|
||||
session.AddProp(model.SessionPropType, model.SessionTypeCloudKey)
|
||||
return session, nil
|
||||
}
|
||||
return nil, model.NewAppError("GetCloudSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized)
|
||||
return nil, model.NewAppError("GetCloudSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
func (a *App) GetRemoteClusterSession(token string, remoteId string) (*model.Session, *model.AppError) {
|
||||
@@ -59,7 +59,7 @@ func (a *App) GetRemoteClusterSession(token string, remoteId string) (*model.Ses
|
||||
session.AddProp(model.SessionPropType, model.SessionTypeRemoteclusterToken)
|
||||
return session, nil
|
||||
}
|
||||
return nil, model.NewAppError("GetRemoteClusterSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized)
|
||||
return nil, model.NewAppError("GetRemoteClusterSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
||||
@@ -68,7 +68,7 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
||||
// If we don't have the session we are going to create one with the token eventually.
|
||||
if session, _ = a.ch.srv.userService.GetSession(token); session != nil {
|
||||
if session.Token != token {
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "session token is different from the one in DB", http.StatusUnauthorized)
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "session token is different from the one in DB", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
if !session.IsExpired() {
|
||||
@@ -88,12 +88,12 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
||||
} else {
|
||||
mlog.Warn("Error while creating session for user access token", mlog.Err(appErr))
|
||||
}
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": detailedError}, "", statusCode)
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": detailedError}, "", statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
if session.Id == "" || session.IsExpired() {
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "session is either nil or expired", http.StatusUnauthorized)
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "session is either nil or expired", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.SessionIdleTimeoutInMinutes > 0 &&
|
||||
@@ -116,7 +116,7 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
||||
mlog.Warn("Error while revoking session", mlog.Err(err))
|
||||
}
|
||||
})
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "idle timeout", http.StatusUnauthorized)
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "idle timeout", http.StatusUnauthorized)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user