Skip to content

Commit 0060ce7

Browse files
committed
Add setting to allow anonymous editing
1 parent 26034fd commit 0060ce7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

client/src/visualizer_ui.js

+5
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,11 @@ var VisualizerUI = (function($, window, undefined) {
20412041
auth_button.val('Logout ' + user);
20422042
dispatcher.post('user', [user]);
20432043
$('.login').show();
2044+
} else if (response.anonymous) {
2045+
user = 'Anonymous';
2046+
auth_button.hide();
2047+
dispatcher.post('user', [user]);
2048+
$('.login').show();
20442049
} else {
20452050
user = null;
20462051
auth_button.val('Login');

config_template.py

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#WORK_DIR = join(BASE_DIR, 'work')
4646

4747
# To allow editing, include at least one USERNAME:PASSWORD pair below.
48+
# To allow anonymous editing, set `USER_PASSWORD = False`.
4849
# The format is the following:
4950
#
5051
# 'USERNAME': 'PASSWORD',

server/src/auth.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def logout():
101101
def whoami():
102102
json_dic = {}
103103
try:
104-
json_dic['user'] = get_session().get('user')
104+
if USER_PASSWORD != False:
105+
json_dic['user'] = get_session().get('user')
106+
else:
107+
json_dic['anonymous'] = True
105108
except KeyError:
106109
# TODO: Really send this message?
107110
Messager.error('Not logged in!', duration=3)

0 commit comments

Comments
 (0)