[sagenb] 01/02: Get the accounts parameter and config option to play nicely; don't render the register page when accounts is False.
felix salfelder
felix-guest at alioth.debian.org
Thu Sep 12 10:54:43 UTC 2013
This is an automated email from the git hooks/post-receive script.
felix-guest pushed a commit to tag 0.9.1
in repository sagenb.
commit d8dfdb8ba2657b6070745a8c968fb9e5870e1b23
Author: Jason Grout <jason.grout at drake.edu>
Date: Thu May 17 20:12:41 2012 -0500
Get the accounts parameter and config option to play nicely; don't render the register page when accounts is False.
(cherry picked from commit 5723d402975c0917273412cd9e212b9082c1a0b6)
---
flask_version/authentication.py | 2 ++
sagenb/notebook/run_notebook.py | 8 +++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/flask_version/authentication.py b/flask_version/authentication.py
index 2b7b6e2..e905c61 100644
--- a/flask_version/authentication.py
+++ b/flask_version/authentication.py
@@ -94,6 +94,8 @@ waiting = {}
@authentication.route('/register', methods = ['GET','POST'])
@with_lock
def register():
+ if not g.notebook.user_manager().get_accounts():
+ return redirect(url_for('base.index'))
from sagenb.notebook.misc import is_valid_username, is_valid_password, \
is_valid_email, do_passwords_match
from sagenb.notebook.challenge import challenge
diff --git a/sagenb/notebook/run_notebook.py b/sagenb/notebook/run_notebook.py
index da1a136..d47298d 100644
--- a/sagenb/notebook/run_notebook.py
+++ b/sagenb/notebook/run_notebook.py
@@ -288,13 +288,15 @@ def notebook_twisted(self,
if openid is not None:
nb.conf()['openid'] = openid
elif not nb.conf()['openid']:
+ # What is the purpose behind this elif? It seems rather pointless.
+ # all it appears to do is set the config to False if bool(config) is False
nb.conf()['openid'] = False
if accounts is not None:
nb.user_manager().set_accounts(accounts)
- elif not nb.conf()['accounts']:
- nb.user_manager().set_accounts(True)
-
+ else:
+ nb.user_manager().set_accounts(nb.conf()['accounts'])
+
if nb.user_manager().user_exists('root') and not nb.user_manager().user_exists('admin'):
# This is here only for backward compatibility with one
# version of the notebook.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git
More information about the debian-science-commits
mailing list