Skip to content
Snippets Groups Projects
Commit ba599ee2 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

[konheko] Fix some login page flow issues

* Fix page not transitioning back, if error happens to fast
* Fix error label not going away, when you fixed the login id
* Fix homeserver not updating, when you change your mxid
parent 62380000
No related branches found
No related tags found
No related merge requests found
Pipeline #147 passed
......@@ -65,9 +65,8 @@ Page {
TextArea {
id: user_parse_error
visible: false
visible: text
color: "red"
font.pixelSize: 0
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
readOnly: true
......@@ -80,7 +79,6 @@ Page {
target: login
onUserParseError: {
user_parse_error.text = error;
user_parse_error.visible = true;
}
}
......@@ -88,7 +86,6 @@ Page {
target: login
onHomeserverInvalid: {
user_parse_error.text = error;
user_parse_error.visible = true;
column.validateLogin();
}
}
......@@ -97,7 +94,7 @@ Page {
target: login
onLoginError: {
user_parse_error.text = error;
user_parse_error.visible = true;
pageStack.completeAnimation();
pageStack.navigateBack();
column.validateLogin();
}
......@@ -108,12 +105,11 @@ Page {
TextField {
id: mxid
//: TextField hint for entering matrix id
label: qsTr("@matrix-id:your.homeserver")
placeholderText: label
EnterKey.enabled: text || inputMethodComposing
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: {
function validateInput() {
if (activeFocus)
return ;
user_parse_error.text = "";
if (homeserver.text.length == 0)
homeserver.visible = false;
......@@ -121,6 +117,14 @@ Page {
password.focus = true;
column.validateLogin();
}
//: TextField hint for entering matrix id
label: qsTr("@matrix-id:your.homeserver")
placeholderText: label
EnterKey.enabled: text || inputMethodComposing
EnterKey.iconSource: "image://theme/icon-m-enter-next"
onActiveFocusChanged: validateInput()
EnterKey.onClicked: validateInput()
inputMethodHints: Qt.ImhNoPredictiveText
anchors {
......@@ -184,6 +188,9 @@ Page {
homeserver.text = server;
homeserver.visible = true;
}
onHomeserverValid: {
homeserver.text = server;
}
}
validator: RegExpValidator {
......
......@@ -100,6 +100,8 @@ void Login::validateServer(QString server) {
"the homeserver domain is valid."));
return;
}
emit homeserverValid(server);
});
}
......@@ -132,7 +134,7 @@ void Login::login(QString mxid, QString password, QString server) {
http::client().login(user.localpart(), password.toStdString(), "Konheko",
[this, homeserver](const mtx::responses::Login &response, mtx::http::RequestErr error) {
if (error) {
qDebug() << "Failed login!\n";
qDebug() << "Failed login!: " << *error;
if (!error->matrix_error.error.empty()) {
emit loginError(QString::fromStdString(error->matrix_error.error));
return;
......
......@@ -11,6 +11,7 @@ class Login : public QObject {
signals:
void userParseError(QString error);
void homeserverInvalid(QString server, QString error);
void homeserverValid(QString server);
void loginError(QString error);
void loginSuccess();
void loggedOut();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment