GODT-1358: Fix wording

This commit is contained in:
Alexander Bilyak
2021-10-07 11:18:40 +00:00
committed by Jakub
parent ef051d5ed6
commit 94347d95df
12 changed files with 43 additions and 17 deletions

View File

@ -269,6 +269,8 @@ func loadCache(b *base.Base) (cache.Cache, error) {
path = customPath
} else {
path = b.Cache.GetDefaultMessageCacheDir()
// Store path so it will allways persist if default location will be changed in new version.
b.Settings.Set(settings.CacheLocationKey, path)
}
return cache.NewOnDiskCache(path, compressor, cache.Options{

View File

@ -162,7 +162,7 @@ ColumnLayout {
enabled: user !== undefined //&& user.isLoginRequested && !user.isLogin2FARequested && !user.isLogin2PasswordRequested
onClicked: {
root.backend.login2FARequested()
root.backend.login2FARequested(user.username)
user.isLogin2FARequested = true
}
}

View File

@ -636,7 +636,7 @@ Window {
signal loginUsernamePasswordError(string errorMsg)
signal loginFreeUserError()
signal loginConnectionError(string errorMsg)
signal login2FARequested()
signal login2FARequested(string username)
signal login2FAError(string errorMsg)
signal login2FAErrorAbort(string errorMsg)
signal login2PasswordRequested()
@ -799,7 +799,7 @@ Window {
console.debug("<- loginConnectionError")
}
onLogin2FARequested: {
console.debug("<- login2FARequested")
console.debug("<- login2FARequested", username)
}
onLogin2FAError: {
console.debug("<- login2FAError")

View File

@ -50,8 +50,8 @@ SettingsView {
SettingsItem {
id: autostart
colorScheme: root.colorScheme
text: qsTr("Automatically start Bridge")
description: qsTr("The app will autostart everytime you reset your device.")
text: qsTr("Open on startup")
description: qsTr("Bridge will open upon startup.")
type: SettingsItem.Toggle
checked: root.backend.isAutostartOn
onClicked: {
@ -159,7 +159,7 @@ SettingsView {
colorScheme: root.colorScheme
text: qsTr("Local cache")
actionText: qsTr("Configure")
description: qsTr("Configure Bridge's local cache settings.")
description: qsTr("Configure Bridge's local cache.")
type: SettingsItem.Button
onClicked: root.parent.showLocalCacheSettings()

View File

@ -39,7 +39,7 @@ SettingsView {
Label {
colorScheme: root.colorScheme
text: qsTr("Bridge caches your encrypted messages localy to optimise the communication with the local client. Disabling this feature might have a nevative impact on performance.")
text: qsTr("Bridge stores your encrypted messages locally to optimize communication with the local client.")
type: Label.Body
color: root.colorScheme.text_weak
Layout.fillWidth: true
@ -50,7 +50,7 @@ SettingsView {
SettingsItem {
colorScheme: root.colorScheme
text: qsTr("Enable local cache")
description: "When enabled messages are stored on disk." // TODO: wrong text in wireframe
description: qsTr("Recommended for optimal performance.")
type: SettingsItem.Toggle
checked: root._diskCacheEnabled
onClicked: root._diskCacheEnabled = !root._diskCacheEnabled
@ -145,5 +145,7 @@ SettingsView {
root._diskCachePath = path.replace(pattern, "")
}
Component.onCompleted: root.setDefaultValues()
onVisibleChanged: {
root.setDefaultValues()
}
}

View File

@ -769,7 +769,7 @@ QtObject {
property Notification resetBridge: Notification {
text: qsTr("Reset Bridge?")
description: qsTr("This will clear your accounts, preferences, and cached data. You will need to reconfigure your email client. Bridge will automatically restart")
description: qsTr("This will clear your accounts, preferences, and cached data. You will need to reconfigure your email client. Bridge will automatically restart.")
type: Notification.NotificationType.Warning
group: Notifications.Group.Configuration | Notifications.Group.Dialogs

View File

@ -73,7 +73,7 @@ Item {
stackLayout.loginFailed()
if (errorMsg!="") errorLabel.text = errorMsg
else errorLabel.text = qsTr("Your email and/or password are incorrect")
else errorLabel.text = qsTr("Incorrect login credentials")
}
onLoginFreeUserError: {
@ -89,6 +89,7 @@ Item {
onLogin2FARequested: {
console.assert(stackLayout.currentIndex == 0, "Unexpected login2FARequested")
twoFactorUsernameLabel.text = username
stackLayout.currentIndex = 1
}
onLogin2FAError: {
@ -289,7 +290,7 @@ Item {
Label {
colorScheme: root.colorScheme
textFormat: Text.StyledText
text: link("https://protonmail.com/upgrade", qsTr("Create or upgrade your account"))
text: link("https://protonmail.com/signup", qsTr("Create or upgrade your account"))
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 24
type: Label.LabelType.Body
@ -323,13 +324,24 @@ Item {
type: Label.LabelType.Heading
}
Label {
colorScheme: root.colorScheme
id: twoFactorUsernameLabel
Layout.alignment: Qt.AlignCenter
Layout.topMargin: 8
type: Label.LabelType.Lead
color: root.colorScheme.text_weak
}
TextField {
colorScheme: root.colorScheme
id: twoFactorPasswordTextField
label: qsTr("Two-factor authentication code")
label: qsTr("Two-factor code")
assistiveText: qsTr("Enter the 6-digit code")
Layout.fillWidth: true
Layout.topMargin: 8 + implicitHeight + 24 + subTitle.implicitHeight
Layout.topMargin: 32
onTextEdited: {
if (error) {

View File

@ -89,7 +89,7 @@ Item {
Label {
colorScheme: root.colorScheme
text: qsTr("Welcome to\nProtonMail Bridge")
text: qsTr("Welcome to\nProton Mail Bridge")
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.topMargin: 16

View File

@ -39,6 +39,12 @@ func (f *FrontendQt) login(username, password string) {
f.authClient, f.auth, err = f.bridge.Login(username, f.password)
if err != nil {
if err == pmapi.ErrPasswordWrong {
// Remove error message since it is hardcodded in QML.
f.qml.LoginUsernamePasswordError("")
f.loginClean()
return
}
if err == pmapi.ErrPaidPlanRequired {
f.qml.LoginFreeUserError()
f.loginClean()
@ -50,7 +56,7 @@ func (f *FrontendQt) login(username, password string) {
}
if f.auth.HasTwoFactor() {
f.qml.Login2FARequested()
f.qml.Login2FARequested(username)
return
}
if f.auth.HasMailboxPassword() {

View File

@ -57,7 +57,7 @@ type QMLBackend struct {
_ func(errorMsg string) `signal:"loginUsernamePasswordError"`
_ func() `signal:"loginFreeUserError"`
_ func(errorMsg string) `signal:"loginConnectionError"`
_ func() `signal:"login2FARequested"`
_ func(username string) `signal:"login2FARequested"`
_ func(errorMsg string) `signal:"login2FAError"`
_ func(errorMsg string) `signal:"login2FAErrorAbort"`
_ func() `signal:"login2PasswordRequested"`

View File

@ -28,6 +28,7 @@ var (
ErrBad2FACodeTryAgain = errors.New("incorrect 2FA code: please try again")
ErrPaidPlanRequired = errors.New("paid subscription plan is required")
ErrPasswordWrong = errors.New("wrong password")
)
type ErrUnprocessableEntity struct {

View File

@ -31,6 +31,7 @@ import (
const (
errCodeUpgradeApplication = 5003
errCodePasswordWrong = 8002
errCodeAuthPaidPlanRequired = 10004
)
@ -61,6 +62,8 @@ func (m *manager) catchAPIError(_ *resty.Client, res *resty.Response) error {
if m.cfg.UpgradeApplicationHandler != nil {
m.cfg.UpgradeApplicationHandler()
}
case apiErr.Code == errCodePasswordWrong:
err = ErrPasswordWrong
case apiErr.Code == errCodeAuthPaidPlanRequired:
err = ErrPaidPlanRequired
case res.StatusCode() == http.StatusUnprocessableEntity: