diff --git a/core/js/js.js b/core/js/js.js
index efdb36187cdc9ea1302d5928e0ea10bf18790656..e8f6df4cfa9b1e41f0830c47da9bfbf7cc7a2551 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1546,11 +1546,7 @@ OC.PasswordConfirmation = {
 		if (this.requiresPasswordConfirmation()) {
 			this.$form.removeClass('hidden');
 			this.$background.removeClass('hidden');
-
-			// Hack against firefox ignoring autocomplete="off"
-			if (this.$input.val() === ' ') {
-				this.$input.val('');
-			}
+			this.$input.val('');
 		}
 
 		this.callback = callback;
@@ -1568,6 +1564,7 @@ OC.PasswordConfirmation = {
 			},
 			type: 'POST',
 			success: function(response) {
+				self.$input.val('');
 				nc_lastLogin = response.lastLogin;
 				self.$submit.addClass('icon-confirm').removeClass('icon-loading-small');
 
@@ -1579,6 +1576,7 @@ OC.PasswordConfirmation = {
 				}
 			},
 			error: function() {
+				self.$input.val('');
 				OC.Notification.showTemporary(t('core', 'Failed to authenticate, try again'));
 				self.$submit.addClass('icon-confirm').removeClass('icon-loading-small');
 			}
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 1b4f0bc0030a1238c1d12b67d800dc976ceb4bb4..8689bf859afcb53a7af82b2584935b7996002976 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -148,7 +148,7 @@
 
 		<div id="sudo-login-background" class="hidden"></div>
 		<div id="sudo-login-form" class="hidden">
-			<input type="password" class="question" autocomplete="off" name="question" value=" "
+			<input type="password" class="question" autocomplete="off" name="question" value=" <?php /* Hack against firefox ignoring autocomplete="off" */ ?>"
 				placeholder="<?php p($l->t('Confirm your password')); ?>" />
 			<input class="confirm icon-confirm" title="<?php p($l->t('Confirm')); ?>" value="" type="submit">
 		</div>