login variants fields fixes
This commit is contained in:
@@ -585,8 +585,9 @@ Window {
|
||||
id: pfLogin
|
||||
x: 20
|
||||
width: parent.width - 40
|
||||
enabled: pfAuth.currentIndex !== 2
|
||||
placeholderText: pfAuth.currentIndex === 2 ? "Ник придёт из аккаунта" : "Логин"
|
||||
// Ник лицензионного профиля приходит из аккаунта: поля здесь нет.
|
||||
visible: pfAuth.currentIndex !== 2
|
||||
placeholderText: "Логин"
|
||||
color: "#ffffff"
|
||||
placeholderTextColor: "#666666"
|
||||
background: Rectangle {
|
||||
@@ -601,8 +602,8 @@ Window {
|
||||
id: pfPassword
|
||||
x: 20
|
||||
width: parent.width - 40
|
||||
enabled: pfAuth.currentIndex === 1
|
||||
placeholderText: pfAuth.currentIndex === 1 ? "Пароль Ely.by" : "Не нужен для этого типа"
|
||||
visible: pfAuth.currentIndex === 1
|
||||
placeholderText: "Пароль Ely.by"
|
||||
echoMode: TextInput.Password
|
||||
color: "#ffffff"
|
||||
placeholderTextColor: "#666666"
|
||||
@@ -675,7 +676,12 @@ Window {
|
||||
const type = pfAuth.currentIndex === 2 ? "microsoft"
|
||||
: pfAuth.currentIndex === 1 ? "elyby" : "offline"
|
||||
if (name !== "") {
|
||||
backend.addProfile(name, pfLogin.text.trim(), pfPassword.text, type)
|
||||
// Скрытые поля не сохраняем: в них мог остаться текст, набранный
|
||||
// до переключения типа профиля.
|
||||
backend.addProfile(name,
|
||||
type === "microsoft" ? "" : pfLogin.text.trim(),
|
||||
type === "elyby" ? pfPassword.text : "",
|
||||
type)
|
||||
profileBox.currentIndex = backend.profileNames.length - 1
|
||||
// Профиль Microsoft без входа бесполезен: сразу показываем окно.
|
||||
if (type === "microsoft")
|
||||
@@ -767,8 +773,9 @@ Window {
|
||||
id: epLogin
|
||||
x: 20
|
||||
width: parent.width - 40
|
||||
enabled: epAuth.currentIndex !== 2
|
||||
placeholderText: epAuth.currentIndex === 2 ? "Ник придёт из аккаунта" : "Логин"
|
||||
// Для лицензии логин не вводят: ниже показан ник из аккаунта.
|
||||
visible: epAuth.currentIndex !== 2
|
||||
placeholderText: "Логин"
|
||||
color: "#ffffff"
|
||||
placeholderTextColor: "#666666"
|
||||
background: Rectangle {
|
||||
@@ -779,12 +786,31 @@ Window {
|
||||
}
|
||||
}
|
||||
|
||||
// Логин лицензионного профиля — ник, полученный при официальной
|
||||
// авторизации. Отдельное поле, а не подмена epLogin.text: биндинг
|
||||
// сломался бы первым же вводом в поле логина обычного профиля.
|
||||
TextField {
|
||||
id: epMsLogin
|
||||
x: 20
|
||||
width: parent.width - 40
|
||||
visible: epAuth.currentIndex === 2 && editProfileDialog.msName !== ""
|
||||
readOnly: true
|
||||
text: editProfileDialog.msName
|
||||
color: "#ffffff"
|
||||
background: Rectangle {
|
||||
color: "#2a2a2a"
|
||||
radius: 6
|
||||
border.color: "#444444"
|
||||
border.width: 1
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: epPassword
|
||||
x: 20
|
||||
width: parent.width - 40
|
||||
enabled: epAuth.currentIndex === 1
|
||||
placeholderText: epAuth.currentIndex === 1 ? "Пароль Ely.by" : "Не нужен для этого типа"
|
||||
visible: epAuth.currentIndex === 1
|
||||
placeholderText: "Пароль Ely.by"
|
||||
echoMode: TextInput.Password
|
||||
color: "#ffffff"
|
||||
placeholderTextColor: "#666666"
|
||||
@@ -816,9 +842,8 @@ Window {
|
||||
visible: epAuth.currentIndex === 2
|
||||
|
||||
Text {
|
||||
text: editProfileDialog.msLinked
|
||||
? qsTr("Вход выполнен: %1").arg(editProfileDialog.msName)
|
||||
: qsTr("Вход не выполнен")
|
||||
text: editProfileDialog.msLinked ? qsTr("Вход выполнен")
|
||||
: qsTr("Вход не выполнен")
|
||||
color: editProfileDialog.msLinked ? "#91B315" : "#aaaaaa"
|
||||
font.pixelSize: 13
|
||||
}
|
||||
@@ -842,8 +867,7 @@ Window {
|
||||
// Microsoft — сохраняем его до входа, иначе backend
|
||||
// припишет токены профилю другого типа.
|
||||
backend.updateProfile(editProfileDialog.editIndex,
|
||||
epName.text.trim(), epLogin.text.trim(),
|
||||
epPassword.text, "microsoft")
|
||||
epName.text.trim(), "", "", "microsoft")
|
||||
editProfileDialog.close()
|
||||
backend.startMicrosoftLogin(editProfileDialog.editIndex)
|
||||
}
|
||||
@@ -899,10 +923,13 @@ Window {
|
||||
|
||||
onAccepted: {
|
||||
const name = epName.text.trim()
|
||||
const type = epAuth.currentIndex === 2 ? "microsoft"
|
||||
: epAuth.currentIndex === 1 ? "elyby" : "offline"
|
||||
if (editIndex >= 0 && name !== "")
|
||||
backend.updateProfile(editIndex, name, epLogin.text.trim(), epPassword.text,
|
||||
epAuth.currentIndex === 2 ? "microsoft"
|
||||
: epAuth.currentIndex === 1 ? "elyby" : "offline")
|
||||
backend.updateProfile(editIndex, name,
|
||||
type === "microsoft" ? "" : epLogin.text.trim(),
|
||||
type === "elyby" ? epPassword.text : "",
|
||||
type)
|
||||
editIndex = -1
|
||||
epName.text = ""; epLogin.text = ""; epPassword.text = ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user