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

This commit is contained in:
James Allen 2016-05-31 11:47:48 +01:00
parent 345d38c28d
commit daf8f6f3cf

View file

@ -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)