From 0dc1f22abfda08a1963dfadf3d6d9218234a97af Mon Sep 17 00:00:00 2001 From: j Date: Tue, 30 Jul 2019 13:10:21 +0200 Subject: [PATCH 1/2] work around chrome autocomplete for passwords --- static/js/preferencesDialog.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/js/preferencesDialog.js b/static/js/preferencesDialog.js index 70af78f2..25faaf54 100644 --- a/static/js/preferencesDialog.js +++ b/static/js/preferencesDialog.js @@ -43,7 +43,7 @@ pandora.ui.preferencesDialog = function() { id: 'password', label: Ox._('New Password'), labelWidth: 120, - type: 'password', + type: 'text', validate: pandora.validateNewPassword, width: 320 }) @@ -51,6 +51,11 @@ pandora.ui.preferencesDialog = function() { autocomplete: 'new-password' }) .bindEvent({ + focus: function(data) { + this.options({ + type: 'password' + }) + }, validate: function(data) { data.valid && pandora.api.editPreferences({password: data.value}); } From 794b28f833634e00f8f573043cc3fea9791c057d Mon Sep 17 00:00:00 2001 From: j Date: Tue, 30 Jul 2019 13:24:07 +0200 Subject: [PATCH 2/2] stay logged in after changing password --- pandora/user/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index d9639d70..88dc2276 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -6,7 +6,7 @@ random.seed() import re import json -from django.contrib.auth import authenticate, login, logout +from django.contrib.auth import authenticate, login, logout, update_session_auth_hash from django.template import loader from django.conf import settings from django.core.mail import send_mail, BadHeaderError, EmailMessage @@ -719,7 +719,9 @@ def editPreferences(request, data): profile.save() if 'password' in data: change = True - request.user.set_password(data['password']) + user = request.user + user.set_password(data['password']) + update_session_auth_hash(request, user) if 'script' in data: profile = request.user.profile profile.preferences['script'] = data['script']