fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-11-23 11:26 am

[dw-free] cannot re-save password for external site if unchecked

[commit: http://hg.dwscoalition.org/dw-free/rev/39da881c53ea]

http://bugs.dwscoalition.org/show_bug.cgi?id=2934

Don't populate the form with a fake password (we don't store the password as
plaintext, so we can't actually populate with the real password). Fake
password means that people tend to not realize that they need to put in an
actual password when they're re-checking the "save password" box. So.

Patch by [personal profile] fu.

Files modified:
  • htdocs/manage/externalaccount.bml
--------------------------------------------------------------------------------
diff -r 0462d0720db3 -r 39da881c53ea htdocs/manage/externalaccount.bml
--- a/htdocs/manage/externalaccount.bml	Wed Nov 23 19:25:42 2011 +0800
+++ b/htdocs/manage/externalaccount.bml	Wed Nov 23 19:28:46 2011 +0800
@@ -189,12 +189,10 @@
 
     $body .= "<tr><td class='setting_label'><label for='password'>" . $ML{'.setting.xpost.option.password'} . "</label></td>";
 
-    # we don't have the password itself, so either use "" (for no password /
-    # new account) or "__passwd__"
     $body .= "<td>" . LJ::html_text({
         name => "password",
         id => "password",
-        value => $editpage ? "__passwd__" : $POST{password},
+        value => $editpage ? "" : $POST{password},
         disabled => 0,
         size => 40,
         maxlength => 80,
@@ -431,15 +429,15 @@
 # form handler.  edits the given account.
 sub edit_external_account {
     my ($u, $POST, $errs) = @_;
-    
+
     my $acct = DW::External::Account->get_external_account($u, $POST{acctid});
     return 0 unless $acct;
-    
+
     my $newpw = $POST{password} || "";
     if (! $POST{savepassword}) {
-        # don't save the password.
+        # don't save the password. checkbox unchecked
         $acct->set_password("");
-    } elsif ($POST{password} ne "__passwd__") {
+    } elsif ( $POST{password} && $POST{password} ne "" ) {
         # we have a password
         $acct->set_password($POST{password});
     }
--------------------------------------------------------------------------------