forked from Silverfish/proton-bridge
feat(GODT-2767): login right pane. [skip-ci]
This commit is contained in:
@ -21,8 +21,32 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property ColorScheme colorScheme
|
property ColorScheme colorScheme
|
||||||
property string description: qsTr("Let's start by signing in to your Proton account.")
|
property string description: ""
|
||||||
|
property string helpLink: ""
|
||||||
|
|
||||||
|
function show2FA() {
|
||||||
|
root.description = qsTr("You have enabled two-factor authentication. Please enter the 6-digit code provided by your authenticator application.");
|
||||||
|
root.helpLink = "";
|
||||||
|
}
|
||||||
|
function showMailboxPassword() {
|
||||||
|
root.description = qsTr("You have secured your account with a separate mailbox password. ");
|
||||||
|
root.helpLink = "";
|
||||||
|
}
|
||||||
|
function showSignIn() {
|
||||||
|
root.description = qsTr("Let's start by signing in to your Proton account.");
|
||||||
|
root.helpLink = linkLabel.link("https://proton.me/mail/pricing", qsTr("Create or upgrade your account"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onLogin2FARequested() {
|
||||||
|
show2FA();
|
||||||
|
}
|
||||||
|
function onLogin2PasswordRequested() {
|
||||||
|
showMailboxPassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: Backend
|
||||||
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@ -59,13 +83,17 @@ Item {
|
|||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
|
id: linkLabel
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
Layout.topMargin: 96
|
Layout.topMargin: 96
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: link("https://proton.me/mail/pricing", qsTr("Create or upgrade your account"))
|
text: root.helpLink
|
||||||
type: Label.LabelType.Body
|
type: Label.LabelType.Body
|
||||||
|
visible: {
|
||||||
|
root.helpLink !== "";
|
||||||
|
}
|
||||||
|
|
||||||
onLinkActivated: function (link) {
|
onLinkActivated: function (link) {
|
||||||
Qt.openUrlExternally(link);
|
Qt.openUrlExternally(link);
|
||||||
|
|||||||
@ -40,34 +40,6 @@ FocusScope {
|
|||||||
|
|
||||||
implicitHeight: children[0].implicitHeight
|
implicitHeight: children[0].implicitHeight
|
||||||
implicitWidth: children[0].implicitWidth
|
implicitWidth: children[0].implicitWidth
|
||||||
state: "Page 1"
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "Page 1"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
currentIndex: 0
|
|
||||||
target: stackLayout
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "Page 2"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
currentIndex: 1
|
|
||||||
target: stackLayout
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "Page 3"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
currentIndex: 2
|
|
||||||
target: stackLayout
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
StackLayout {
|
StackLayout {
|
||||||
id: stackLayout
|
id: stackLayout
|
||||||
@ -169,10 +141,9 @@ FocusScope {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.topMargin: 16
|
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("Sign in")
|
text: qsTr("Sign in")
|
||||||
type: Label.LabelType.Title
|
type: Label.LabelType.Heading
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
id: subTitle
|
id: subTitle
|
||||||
@ -181,11 +152,11 @@ FocusScope {
|
|||||||
color: root.colorScheme.text_weak
|
color: root.colorScheme.text_weak
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("Enter your Proton Account details.")
|
text: qsTr("Enter your Proton Account details.")
|
||||||
type: Label.LabelType.Body
|
type: Label.LabelType.Lead
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 36
|
Layout.topMargin: 48
|
||||||
spacing: 0
|
spacing: 0
|
||||||
visible: errorLabel.text.length > 0
|
visible: errorLabel.text.length > 0
|
||||||
|
|
||||||
@ -208,7 +179,7 @@ FocusScope {
|
|||||||
TextField {
|
TextField {
|
||||||
id: usernameTextField
|
id: usernameTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 48
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
focus: true
|
focus: true
|
||||||
label: qsTr("Email or username")
|
label: qsTr("Email or username")
|
||||||
@ -232,7 +203,7 @@ FocusScope {
|
|||||||
TextField {
|
TextField {
|
||||||
id: passwordTextField
|
id: passwordTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 8
|
Layout.topMargin: 48
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
label: qsTr("Password")
|
label: qsTr("Password")
|
||||||
@ -268,7 +239,7 @@ FocusScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 48
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
enabled: !loading
|
enabled: !loading
|
||||||
text: loading ? qsTr("Signing in") : qsTr("Sign in")
|
text: loading ? qsTr("Signing in") : qsTr("Sign in")
|
||||||
@ -278,11 +249,10 @@ FocusScope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: cancelButton
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 32
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
enabled: !loading
|
enabled: !signInButton.loading
|
||||||
secondary: true
|
secondary: true
|
||||||
text: qsTr("Cancel")
|
text: qsTr("Cancel")
|
||||||
|
|
||||||
@ -305,7 +275,6 @@ FocusScope {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
Layout.topMargin: 16
|
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("Two-factor authentication")
|
text: qsTr("Two-factor authentication")
|
||||||
type: Label.LabelType.Heading
|
type: Label.LabelType.Heading
|
||||||
@ -344,7 +313,7 @@ FocusScope {
|
|||||||
Button {
|
Button {
|
||||||
id: twoFAButton
|
id: twoFAButton
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 48
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
enabled: !loading
|
enabled: !loading
|
||||||
text: loading ? qsTr("Authenticating") : qsTr("Authenticate")
|
text: loading ? qsTr("Authenticating") : qsTr("Authenticate")
|
||||||
@ -359,6 +328,18 @@ FocusScope {
|
|||||||
Backend.login2FA(usernameTextField.text, Qt.btoa(twoFactorPasswordTextField.text));
|
Backend.login2FA(usernameTextField.text, Qt.btoa(twoFactorPasswordTextField.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Button {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 32
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
enabled: !twoFAButton.loading
|
||||||
|
secondary: true
|
||||||
|
text: qsTr("Cancel")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
root.abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: login2PasswordLayout
|
id: login2PasswordLayout
|
||||||
@ -374,15 +355,21 @@ FocusScope {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
Layout.topMargin: 16
|
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("Unlock your mailbox")
|
text: qsTr("Unlock your mailbox")
|
||||||
type: Label.LabelType.Heading
|
type: Label.LabelType.Heading
|
||||||
}
|
}
|
||||||
|
Label {
|
||||||
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
Layout.topMargin: 8
|
||||||
|
color: root.colorScheme.text_weak
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
type: Label.LabelType.Lead
|
||||||
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: secondPasswordTextField
|
id: secondPasswordTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 8 + implicitHeight + 24 + subTitle.implicitHeight
|
Layout.topMargin: 48
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
label: qsTr("Mailbox password")
|
label: qsTr("Mailbox password")
|
||||||
@ -400,7 +387,7 @@ FocusScope {
|
|||||||
Button {
|
Button {
|
||||||
id: secondPasswordButton
|
id: secondPasswordButton
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 48
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
enabled: !loading
|
enabled: !loading
|
||||||
text: loading ? qsTr("Unlocking") : qsTr("Unlock")
|
text: loading ? qsTr("Unlocking") : qsTr("Unlock")
|
||||||
@ -415,6 +402,18 @@ FocusScope {
|
|||||||
Backend.login2Password(usernameTextField.text, Qt.btoa(secondPasswordTextField.text));
|
Backend.login2Password(usernameTextField.text, Qt.btoa(secondPasswordTextField.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Button {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 32
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
enabled: !secondPasswordButton.loading
|
||||||
|
secondary: true
|
||||||
|
text: qsTr("Cancel")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
root.abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@ Item {
|
|||||||
root.visible = true;
|
root.visible = true;
|
||||||
leftContent.currentIndex = 1;
|
leftContent.currentIndex = 1;
|
||||||
rightContent.currentIndex = 1;
|
rightContent.currentIndex = 1;
|
||||||
|
loginLeftPane.showSignIn();
|
||||||
loginRightPane.reset(true);
|
loginRightPane.reset(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ Item {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 96
|
anchors.topMargin: 96
|
||||||
|
clip: true
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
width: 444
|
width: 444
|
||||||
|
|
||||||
@ -73,6 +75,7 @@ Item {
|
|||||||
|
|
||||||
// stack index 1
|
// stack index 1
|
||||||
LoginLeftPane {
|
LoginLeftPane {
|
||||||
|
id: loginLeftPane
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
@ -103,6 +106,7 @@ Item {
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 96
|
anchors.topMargin: 96
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
|
clip: true
|
||||||
width: 444
|
width: 444
|
||||||
|
|
||||||
// stack index 0
|
// stack index 0
|
||||||
|
|||||||
Reference in New Issue
Block a user