Эх сурвалжийг харах

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

James Allen 10 жил өмнө
parent
commit
daf8f6f3cf

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

@@ -103,6 +103,16 @@ define [], () ->
 			@ide.socket.emit 'joinProject', {
 				project_id: @ide.project_id
 			}, (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
 					location.reload(true)