Преглед изворни кода

Refresh the page if the user is not logged in when joining a project

James Allen пре 10 година
родитељ
комит
daf8f6f3cf
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      services/web/public/coffee/ide/connection/ConnectionManager.coffee

+ 10 - 0
services/web/public/coffee/ide/connection/ConnectionManager.coffee

@@ -103,6 +103,16 @@ define [], () ->
 			@ide.socket.emit 'joinProject', {
 			@ide.socket.emit 'joinProject', {
 				project_id: @ide.project_id
 				project_id: @ide.project_id
 			}, (err, project, permissionsLevel, protocolVersion) =>
 			}, (err, project, permissionsLevel, protocolVersion) =>
+				if err?
+					if err.message == "not authorized"
+						window.location = "/login?redir=#{encodeURI(window.location.pathname)}"
+					else
+						@ide.socket.disconnect()
+						@ide.showGenericMessageModal("Something went wrong connecting", """
+							Something went wrong connecting to your project. Please refresh is this continues to happen.
+						""")
+					return
+
 				if @$scope.protocolVersion? and @$scope.protocolVersion != protocolVersion
 				if @$scope.protocolVersion? and @$scope.protocolVersion != protocolVersion
 					location.reload(true)
 					location.reload(true)