mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 15:16:44 +00:00
feat(GODT-2772): placement of error message on login pages.
This commit is contained in:
@ -128,20 +128,24 @@ FocusScope {
|
|||||||
Item {
|
Item {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: loginLayout
|
id: loginLayout
|
||||||
|
function clearErrors() {
|
||||||
|
usernameTextField.error = false;
|
||||||
|
usernameTextField.errorString = "";
|
||||||
|
passwordTextField.error = false;
|
||||||
|
passwordTextField.errorString = "";
|
||||||
|
errorLabel.text = ""
|
||||||
|
}
|
||||||
function reset(clearUsername = false) {
|
function reset(clearUsername = false) {
|
||||||
signInButton.loading = false;
|
signInButton.loading = false;
|
||||||
errorLabel.text = "";
|
errorLabel.text = "";
|
||||||
usernameTextField.enabled = true;
|
usernameTextField.enabled = true;
|
||||||
usernameTextField.error = false;
|
|
||||||
usernameTextField.errorString = "";
|
|
||||||
usernameTextField.focus = true;
|
usernameTextField.focus = true;
|
||||||
if (clearUsername) {
|
if (clearUsername) {
|
||||||
usernameTextField.text = "";
|
usernameTextField.text = "";
|
||||||
}
|
}
|
||||||
passwordTextField.enabled = true;
|
passwordTextField.enabled = true;
|
||||||
passwordTextField.error = false;
|
|
||||||
passwordTextField.errorString = "";
|
|
||||||
passwordTextField.text = "";
|
passwordTextField.text = "";
|
||||||
|
clearErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -174,13 +178,12 @@ FocusScope {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: 0
|
spacing: 0
|
||||||
visible: errorLabel.text.length > 0
|
|
||||||
|
|
||||||
ColorImage {
|
ColorImage {
|
||||||
color: wizard.colorScheme.signal_danger
|
color: wizard.colorScheme.signal_danger
|
||||||
height: errorLabel.lineHeight
|
height: errorLabel.lineHeight
|
||||||
source: "/qml/icons/ic-exclamation-circle-filled.svg"
|
source: "/qml/icons/ic-exclamation-circle-filled.svg"
|
||||||
sourceSize.height: errorLabel.lineHeight
|
sourceSize.height: errorLabel.lineHeight
|
||||||
|
visible: errorLabel.text.length > 0
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
id: errorLabel
|
id: errorLabel
|
||||||
@ -188,7 +191,7 @@ FocusScope {
|
|||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
color: wizard.colorScheme.signal_danger
|
color: wizard.colorScheme.signal_danger
|
||||||
colorScheme: wizard.colorScheme
|
colorScheme: wizard.colorScheme
|
||||||
type: root.error ? Label.LabelType.Caption_semibold : Label.LabelType.Caption
|
type: Label.LabelType.Caption_semibold
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,12 +210,7 @@ FocusScope {
|
|||||||
|
|
||||||
onAccepted: passwordTextField.forceActiveFocus()
|
onAccepted: passwordTextField.forceActiveFocus()
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
// remove "invalid username / password error"
|
loginLayout.clearErrors();
|
||||||
if (error || errorLabel.text.length > 0) {
|
|
||||||
errorLabel.text = "";
|
|
||||||
usernameTextField.error = false;
|
|
||||||
passwordTextField.error = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
@ -230,12 +228,7 @@ FocusScope {
|
|||||||
|
|
||||||
onAccepted: signInButton.checkAndSignIn()
|
onAccepted: signInButton.checkAndSignIn()
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
// remove "invalid username / password error"
|
loginLayout.clearErrors();
|
||||||
if (error || errorLabel.text.length > 0) {
|
|
||||||
errorLabel.text = "";
|
|
||||||
usernameTextField.error = false;
|
|
||||||
passwordTextField.error = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
|
|||||||
Reference in New Issue
Block a user