Refactor login
BUG: 469486
This commit is contained in:
@@ -38,6 +38,10 @@ void Login::init()
|
|||||||
|
|
||||||
connect(this, &Login::matrixIdChanged, this, [this]() {
|
connect(this, &Login::matrixIdChanged, this, [this]() {
|
||||||
setHomeserverReachable(false);
|
setHomeserverReachable(false);
|
||||||
|
QRegularExpression validator("^\\@?[a-zA-Z0-9\\._=\\-/]+\\:[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\:[0-9]+)?$");
|
||||||
|
if (!validator.match(m_matrixId).hasMatch()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_matrixId == "@") {
|
if (m_matrixId == "@") {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ LoginStep {
|
|||||||
Kirigami.FormData.label: i18n("Matrix ID:")
|
Kirigami.FormData.label: i18n("Matrix ID:")
|
||||||
placeholderText: "@user:matrix.org"
|
placeholderText: "@user:matrix.org"
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (acceptableInput) {
|
LoginHelper.matrixId = text
|
||||||
LoginHelper.matrixId = text
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@@ -41,15 +39,11 @@ LoginStep {
|
|||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
login.action.trigger()
|
login.action.trigger()
|
||||||
}
|
}
|
||||||
|
|
||||||
validator: RegularExpressionValidator {
|
|
||||||
regularExpression: /^\@?[a-zA-Z0-9\._=\-/]+\:[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\:[0-9]+)?$/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
action: Kirigami.Action {
|
action: Kirigami.Action {
|
||||||
text: LoginHelper.testing && matrixIdField.acceptableInput ? (LoginHelper.isLoggedIn ? i18n("Already logged in") : i18n("Loading…")) : i18nc("@action:button", "Continue")
|
text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (LoginHelper.supportsSso && LoginHelper.supportsPassword) {
|
if (LoginHelper.supportsSso && LoginHelper.supportsPassword) {
|
||||||
processed("qrc:/LoginMethod.qml");
|
processed("qrc:/LoginMethod.qml");
|
||||||
|
|||||||
Reference in New Issue
Block a user