Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Student should be redirected to login page if he/she gets looged out while doing playlist exercies #2939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion kalite/distributed/static/js/distributed/exercises.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ window.AttemptLogCollection = Backbone.Collection.extend({
},

url: function() {
return "/api/attemptlog/?" + $.param(this.filters, true);
if (window.statusModel.get("is_logged_in")) {
return "/api/attemptlog/?" + $.param(this.filters, true);
}
else {
window.location = "/securesync/login";

This comment was marked as spam.

}

This comment was marked as spam.

This comment was marked as spam.

},

add_new: function(attemptlog) {
Expand Down
10 changes: 8 additions & 2 deletions kalite/playlist/static/js/playlist/view_playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ window.PlaylistContentAreaView = Backbone.View.extend({
},

render: function() {
this.$el.html(this.template(this.model.attributes));
return this;
if (window.statusModel.get("is_logged_in")) {
this.$el.html(this.template(this.model.attributes));
return this;
}
else
{
window.location = "/securesync/login";
}
},

show_view: function(view) {
Expand Down
3 changes: 2 additions & 1 deletion kalite/playlist/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from annoying.decorators import render_to

from kalite.shared.decorators import require_admin
from kalite.shared.decorators import require_admin, require_login


@require_admin
Expand All @@ -12,6 +12,7 @@ def assign_playlists(request):
return context


@require_login
@render_to("playlist/view_playlist.html")
def view_playlist(request, playlist_id):
context = {
Expand Down