'.join(u'%s' % p.replace('\n', ' \n') for p in _paragraph_re.split(text))
return Markup(result)
+ @app.template_filter('sp2nbsp')
+ def sp2nbsp(text):
+ text = escape(text)
+ result = u'
'.join(u'%s' % p.replace(' ', ' ') for p in _paragraph_re.split(text))
+ return Markup(result)
+
@app.template_filter('format_dt')
def format_datetime(dt, formatting="%a, %d %b %Y"):
"""
diff --git a/oshipka/webapp/default_routes.py b/oshipka/webapp/default_routes.py
index 2b17dc3..694ad77 100644
--- a/oshipka/webapp/default_routes.py
+++ b/oshipka/webapp/default_routes.py
@@ -45,7 +45,8 @@ if SECURITY_ENABLED:
@oshipka_bp.route('/sso')
def sso():
callback_url = APP_BASE_URL + url_for('oshipka_bp.oidc_callback')
- state = request.referrer or url_for('home') + "|" + random_string_generator()
+ url_to_redicrect_back = request.referrer or url_for('home')
+ state = url_to_redicrect_back + "|" + random_string_generator()
session['oidc_state'] = state
params = urllib.parse.urlencode({
'redirect_uri': callback_url,
@@ -64,7 +65,7 @@ if SECURITY_ENABLED:
if error:
return jsonify({"error": "from auth server: {}".format(error)}), 400
state = request.args.get('state')
- session_state = session['oidc_state']
+ session_state = session.get('oidc_state')
if state != session_state:
return jsonify({"error": "state is different from session state"}), 400
code = request.args.get('code')
@@ -170,6 +171,10 @@ if SECURITY_ENABLED:
for k, v in data.items():
if k in ['csrf_token']:
continue
+ if k.startswith('users-'):
+ continue
+ if k.startswith('roles-'):
+ continue
_, subject, action = k.split('-')
sub_split, subject_id = subject.split('_'), None
if len(sub_split) == 2:
diff --git a/oshipka/webapp/templates/_users_roles_multiselect.html b/oshipka/webapp/templates/_users_roles_multiselect.html
index 1bd950e..fd55525 100644
--- a/oshipka/webapp/templates/_users_roles_multiselect.html
+++ b/oshipka/webapp/templates/_users_roles_multiselect.html
@@ -1,5 +1,5 @@