[dw-free] Entry preview shows the wrong user when browser autofills username/password
[commit: http://hg.dwscoalition.org/dw-free/rev/0a49a231ba1a]
http://bugs.dwscoalition.org/show_bug.cgi?id=3202
This field may have been filled by browser autofill, so check that we meant
to login as another user before deciding that we are previewing as that
user.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3202
This field may have been filled by browser autofill, so check that we meant
to login as another user before deciding that we are previewing as that
user.
Patch by
Files modified:
- htdocs/js/entry.js
- htdocs/preview/entry.bml
--------------------------------------------------------------------------------
diff -r 51c560bfee1f -r 0a49a231ba1a htdocs/js/entry.js
--- a/htdocs/js/entry.js Wed Nov 03 18:44:20 2010 +0800
+++ b/htdocs/js/entry.js Thu Nov 04 17:50:50 2010 +0800
@@ -217,10 +217,15 @@ function entryPreview(entryForm) {
function entryPreview(entryForm) {
var f=entryForm;
var action=f.action;
- f.action='/preview/entry';
+
+ if (f.action.indexOf("altlogin=1") != -1)
+ f.action='/preview/entry?altlogin=1';
+ else
+ f.action='/preview/entry';
+
f.target='preview';
window.open('','preview','width=760,height=600,resizable=yes,status=yes,toolbar=no,location=no,menubar=no,scrollbars=yes');
- f.submit();
+ f.submit();
f.action=action;
f.target='_self';
return false;
diff -r 51c560bfee1f -r 0a49a231ba1a htdocs/preview/entry.bml
--- a/htdocs/preview/entry.bml Wed Nov 03 18:44:20 2010 +0800
+++ b/htdocs/preview/entry.bml Thu Nov 04 17:50:50 2010 +0800
@@ -26,7 +26,7 @@ _c?>
if ($POST{'usejournal'}) {
$u = LJ::load_user($POST{'usejournal'});
$up = $POST{'user'} ? LJ::load_user($POST{'user'}) : $remote;
- } elsif ($POST{'user'}) {
+ } elsif ($POST{'user'} && $GET{altlogin}) {
$u = LJ::load_user($POST{'user'});
} else {
$u = $remote;
--------------------------------------------------------------------------------
