Merge pull request #1229 from nextcloud/bugfix/change-password-changes

Bugfix/change password changes
This commit is contained in:
Morris Jobke 2016-10-06 12:44:50 +02:00 committed by GitHub
commit 8fecf8503a
4 changed files with 25 additions and 6 deletions

View File

@ -490,8 +490,9 @@ label.infield {
}
#personal-show + label {
height: 14px;
margin-top: 14px;
margin-left: -36px;
margin-top: -25px;
left: 295px;
display: block;
}
#passwordbutton {
margin-left: .5em;

View File

@ -96,6 +96,10 @@ input#identity {
padding: 3px;
}
.password-state {
display: inline-block;
}
table.nostyle label { margin-right: 2em; }
table.nostyle td { padding: 0.2em 0; }

View File

@ -197,8 +197,16 @@ $(document).ready(function () {
if($('#pass2').length) {
$('#pass2').showPassword().keyup();
}
var removeloader = function () {
setTimeout(function(){
if ($('.password-state').length > 0) {
$('.password-state').remove();
}
}, 5000)
};
$("#passwordbutton").click(function () {
OC.msg.startSaving('#password-error-msg');
var isIE8or9 = $('html').hasClass('lte9');
// FIXME - TODO - once support for IE8 and IE9 is dropped
// for IE8 and IE9 this will check additionally if the typed in password
@ -210,12 +218,17 @@ $(document).ready(function () {
var post = $("#passwordform").serialize();
$('#passwordchanged').hide();
$('#passworderror').hide();
$("#passwordbutton").attr('disabled', 'disabled');
$("#passwordbutton").after("<span class='password-loading icon icon-loading-small-dark password-state'></span>");
$(".personal-show-label").hide();
// Ajax foo
$.post(OC.generateUrl('/settings/personal/changepassword'), post, function (data) {
if (data.status === "success") {
$("#passwordbutton").after("<span class='checkmark icon icon-checkmark password-state'></span>");
removeloader();
$(".personal-show-label").show();
$('#pass1').val('');
$('#pass2').val('').change();
OC.msg.finishedSaving('#password-error-msg', data);
} else {
if (typeof(data.data) !== "undefined") {
OC.msg.finishedSaving('#password-error-msg', data);
@ -230,6 +243,8 @@ $(document).ready(function () {
);
}
}
$(".password-loading").remove();
$("#passwordbutton").removeAttr('disabled');
});
return false;
} else {
@ -243,7 +258,6 @@ $(document).ready(function () {
);
return false;
}
});
$('#displayName').keyUpDelayedOrEnter(changeDisplayName);

View File

@ -129,7 +129,7 @@ if($_['passwordChangeSupported']) {
placeholder="<?php echo $l->t('New password');?>"
data-typetoggle="#personal-show"
autocomplete="off" autocapitalize="off" autocorrect="off" />
<input type="checkbox" id="personal-show" name="show" /><label for="personal-show"></label>
<input type="checkbox" id="personal-show" name="show" /><label for="personal-show" class="personal-show-label"></label>
<input id="passwordbutton" type="submit" value="<?php echo $l->t('Change password');?>" />
<br/>
</form>