Fixes for password changing
This commit is contained in:
committed by
Tobias Fella
parent
99d3ee32fa
commit
44c72828e1
@@ -156,35 +156,35 @@ FormCard.FormCardPage {
|
|||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
FormCard.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
visible: root.connection !== undefined && root.connection.canChangePassword === false
|
visible: root.connection !== undefined && root.connection.canChangePassword === false
|
||||||
text: i18n("Your server doesn't support changing your password")
|
text: i18nc("@info", "Your server doesn't support changing your password")
|
||||||
}
|
}
|
||||||
FormCard.FormDelegateSeparator {
|
FormCard.FormDelegateSeparator {
|
||||||
visible: root.connection !== undefined && root.connection.canChangePassword === false
|
visible: root.connection !== undefined && root.connection.canChangePassword === false
|
||||||
}
|
}
|
||||||
FormCard.FormTextFieldDelegate {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: currentPassword
|
id: currentPassword
|
||||||
label: i18n("Current Password:")
|
label: i18nc("@label:textbox", "Current Password:")
|
||||||
enabled: root.connection !== undefined && root.connection.canChangePassword !== false
|
enabled: root.connection !== undefined && root.connection.canChangePassword !== false
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
}
|
}
|
||||||
FormCard.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
FormCard.FormTextFieldDelegate {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: newPassword
|
id: newPassword
|
||||||
label: i18n("New Password:")
|
label: i18nc("@label:textbox", "New Password:")
|
||||||
enabled: root.connection !== undefined && root.connection.canChangePassword !== false
|
enabled: root.connection !== undefined && root.connection.canChangePassword !== false
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
}
|
}
|
||||||
FormCard.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
FormCard.FormTextFieldDelegate {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: confirmPassword
|
id: confirmPassword
|
||||||
label: i18n("Confirm new Password:")
|
label: i18nc("@label:textbox", "Confirm new Password:")
|
||||||
enabled: root.connection !== undefined && root.connection.canChangePassword !== false
|
enabled: root.connection !== undefined && root.connection.canChangePassword !== false
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
onTextChanged: if (newPassword.text !== confirmPassword.text && confirmPassword.text.length > 0) {
|
onTextChanged: if (newPassword.text !== confirmPassword.text && confirmPassword.text.length > 0) {
|
||||||
confirmPassword.status = FormCard.AbstractFormDelegate.Status.Error;
|
confirmPassword.status = Kirigami.MessageType.Error;
|
||||||
confirmPassword.statusMessage = i18n("Passwords don't match");
|
confirmPassword.statusMessage = i18nc("@info", "Passwords don't match");
|
||||||
} else {
|
} else {
|
||||||
confirmPassword.status = FormCard.AbstractFormDelegate.Status.Default;
|
confirmPassword.status = Kirigami.MessageType.Information;
|
||||||
confirmPassword.statusMessage = '';
|
confirmPassword.statusMessage = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,12 +192,10 @@ FormCard.FormCardPage {
|
|||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
text: i18n("Save")
|
text: i18n("Save")
|
||||||
icon.name: "document-save-symbolic"
|
icon.name: "document-save-symbolic"
|
||||||
enabled: currentPassword.text.length > 0 && newPassword.text.length > 0 && confirmPassword.text.length > 0
|
enabled: currentPassword.text.length > 0 && newPassword.text.length > 0 && confirmPassword.text.length > 0 && newPassword.text === confirmPassword.text
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (newPassword.text === confirmPassword.text) {
|
if (newPassword.text === confirmPassword.text) {
|
||||||
root.connection.changePassword(currentPassword.text, newPassword.text);
|
root.connection.changePassword(currentPassword.text, newPassword.text);
|
||||||
} else {
|
|
||||||
showPassiveNotification(i18n("Passwords do not match"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,11 +268,14 @@ FormCard.FormCardPage {
|
|||||||
target: root.connection
|
target: root.connection
|
||||||
function onPasswordStatus(status) {
|
function onPasswordStatus(status) {
|
||||||
if (status === NeoChatConnection.Success) {
|
if (status === NeoChatConnection.Success) {
|
||||||
showPassiveNotification(i18n("Password changed successfully"));
|
confirmPassword.status = Kirigami.MessageType.Positive
|
||||||
|
confirmPassword.statusMessage = i18nc("@info", "Password changed successfully");
|
||||||
} else if (status === NeoChatConnection.Wrong) {
|
} else if (status === NeoChatConnection.Wrong) {
|
||||||
showPassiveNotification(i18n("Wrong password entered"));
|
confirmPassword.status = Kirigami.MessageType.Error
|
||||||
|
confirmPassword.statusMessage = i18nc("@info", "Invalid password");
|
||||||
} else {
|
} else {
|
||||||
showPassiveNotification(i18n("Unknown problem while trying to change password"));
|
confirmPassword.status = Kirigami.MessageType.Error
|
||||||
|
confirmPassword.statusMessage = i18nc("@info", "Unknown problem while trying to change password");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user