[Rt-commit] rt branch, 4.0/webkit-admin-users-disable-autofill, created. rt-4.0.21-17-ga3f3f02

? sunnavy sunnavy at bestpractical.com
Mon Aug 18 11:30:34 EDT 2014


The branch, 4.0/webkit-admin-users-disable-autofill has been created
        at  a3f3f02c274cc7b7503ee121e711624259b30fa6 (commit)

- Log -----------------------------------------------------------------
commit a3f3f02c274cc7b7503ee121e711624259b30fa6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Aug 18 23:01:58 2014 +0800

    don't autofill username/password on user admin page for safari/chrome
    
    Safari autofills UserName and CurrentPass fields, Chrome autofills Gecos and CurrentPass instead.
    the autofilled values are wrong nearly all the time for admin users page.
    
    this workaround is not good, but at least it works.

diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index 4adc558..46c2637 100644
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -50,7 +50,7 @@
 
 <& /Elements/ListActions, actions => \@results &>
 
-<form action="<%RT->Config->Get('WebPath')%>/Admin/Users/Modify.html" method="post" enctype="multipart/form-data">
+<form action="<%RT->Config->Get('WebPath')%>/Admin/Users/Modify.html" method="post" enctype="multipart/form-data" name="<% $Create ? 'UserCreate': 'UserModify' %>">
 %if ($Create) {
 <input type="hidden" class="hidden" name="id" value="new" />
 % } else {
@@ -221,6 +221,25 @@
 </tr>
 </table>
 
+% if ( !$UserObj->id || $session{CurrentUser}->id != $UserObj->id ) {
+<script type="text/javascript">
+jQuery( function() {
+    if ( navigator.userAgent.indexOf('Chrome') >= 0 ) {
+        setTimeout( function() {
+            jQuery('form[name=UserCreate] input[name=Gecos], form[name=UserModify] input[name=Gecos]').val('<%$UserObj->Gecos||$Gecos||''%>');
+            jQuery('form[name=UserCreate] input[name=CurrentPass], form[name=UserModify] input[name=CurrentPass]').val('');
+        }, 1000 );
+    }
+    else if (navigator.userAgent.indexOf('Safari')) {
+        setTimeout( function() {
+            jQuery('form[name=UserCreate] input[name=Name], form[name=UserModify] input[name=Name]').val('<%$UserObj->Name||$Name||''%>');
+            jQuery('form[name=UserCreate] input[name=CurrentPass], form[name=UserModify] input[name=CurrentPass]').val('');
+        }, 1000 );
+    }
+});
+</script>
+% }
+
 % if ( $Create ) {
 <& /Elements/Submit, Label => loc('Create') &>
 % } else {

-----------------------------------------------------------------------


More information about the rt-commit mailing list