Skip to content

Commit

Permalink
Enabled WebKit prefill (WEBAPP-3210) (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflorian authored and bennycode committed Jan 17, 2017
1 parent 8d6827b commit 57d44ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions app/page/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,17 @@

<form id="form-account-register" class="form" data-bind="submit: register">
<div id="wire-register-name-container" class="form-control">
<input class="input name" id="wire-register-name" type="text" autocomplete="off" maxlength="64" spellcheck="false"
<input class="input name" id="wire-register-name" type="text" maxlength="64" spellcheck="false"
data-bind="css: {'input-error': failed_validation_name}, event: {input: clear_error}, l10n_tooltip: z.string.auth_placeholder_name, l10n_placeholder: z.string.auth_placeholder_name, textInput: name"
data-uie-name="enter-name" tabindex="1" dir="auto">
</div>
<div id="wire-register-email-container" class="form-control">
<input class="input email" id="wire-register-email" type="text" autocomplete="off" maxlength="128" spellcheck="false"
<input class="input email" id="wire-register-email" type="text" maxlength="128" spellcheck="false"
data-bind="css: {'input-error': failed_validation_email}, event: {input: clear_error}, l10n_tooltip: z.string.auth_placeholder_email, l10n_placeholder: z.string.auth_placeholder_email, textInput: username"
data-uie-name="enter-email" tabindex="2">
</div>
<div id="wire-register-password-container" class="form-control">
<input class="input password" id="wire-register-password" type="password" autocomplete="off" maxlength="1024"
<input class="input password" id="wire-register-password" type="password" maxlength="1024"
data-bind="css: {'input-error': failed_validation_password}, event: {input: clear_error_password}, l10n_tooltip: z.string.auth_placeholder_password_set, l10n_placeholder: z.string.auth_placeholder_password_set, textInput: password"
data-uie-name="enter-password" tabindex="3">
</div>
Expand Down Expand Up @@ -180,12 +180,12 @@
<div class="auth-headline" data-bind="l10n_text: z.string.auth_verify_account_headline"></div>
<div class="auth-headline-sub" data-bind="l10n_text: z.string.auth_verify_account_detail"></div>
<div id="wire-verify-account-email-container" class="form-control">
<input class="input email" id="wire-verify-account-email" type="text" autocomplete="off" maxlength="128" spellcheck="false"
<input class="input email" id="wire-verify-account-email" type="text" maxlength="128" spellcheck="false"
data-bind="css: {'input-error': failed_validation_email}, event: {input: clear_error}, l10n_tooltip: z.string.auth_placeholder_email, l10n_placeholder: z.string.auth_placeholder_email, textInput: username"
data-uie-name="enter-email">
</div>
<div id="wire-verify-account-password-container" class="form-control">
<input class="input password" id="wire-verify-account-password" type="password" maxlength="1024" autocomplete="off"
<input class="input password" id="wire-verify-account-password" type="password" maxlength="1024"
data-bind="css: {'input-error': failed_validation_password}, event: {input: clear_error_password}, l10n_tooltip: z.string.auth_placeholder_password_set, l10n_placeholder: z.string.auth_placeholder_password_set, textInput: password"
data-uie-name="enter-password">
</div>
Expand Down Expand Up @@ -262,7 +262,7 @@
<form id="form-verify-phone-password" class="form" data-bind="submit: verify_password">
<div class="auth-headline verify-password-text" data-bind="l10n_text: z.string.auth_verify_password_headline"></div>
<div id="wire-verify-phone-password-container" class="form-control">
<input class="input password" id="wire-verify-password-input" type="password" maxlength="1024" autocomplete="off"
<input class="input password" id="wire-verify-password-input" type="password" maxlength="1024"
data-bind="css: {'input-error': failed_validation_password}, event: {input: clear_error_password}, l10n_tooltip: z.string.auth_placeholder_password_put, l10n_placeholder: z.string.auth_placeholder_password_put, textInput: password"
data-uie-name="enter-password">
</div>
Expand Down
11 changes: 0 additions & 11 deletions app/script/view_model/AuthViewModel.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ class z.ViewModel.AuthViewModel
.on 'hashchange', @_on_hash_change
.on 'keydown', @keydown_auth

$("[id^='wire-login'], [id^='wire-register'], [id^='wire-verify']").prevent_prefill()

# Select country based on location of user IP
@country_code (z.util.CountryCodes.get_country_code($('[name=geoip]').attr 'country') or 1).toString()
@changed_country_code()
Expand Down Expand Up @@ -1342,12 +1340,3 @@ $.fn.extend
window.setTimeout =>
$(@).focus()
, 0

# FIX to prevent unwanted auto form fill on Chrome
prevent_prefill: ->
if z.util.Environment.browser.chrome or z.util.Environment.browser.opera
@each ->
$(@)
.attr 'readonly', true
.on 'focus', ->
$(@).removeAttr 'readonly'
11 changes: 11 additions & 0 deletions app/style/auth/account.less
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,15 @@
}
}
}

input {
&:-webkit-autofill,
&:-webkit-autofill:hover,
&:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0 1000px none inset;
-webkit-text-fill-color: #fff;
border: none;
transition: background-color 5000s ease-in-out 0s;
}
}
}

0 comments on commit 57d44ea

Please sign in to comment.