diff --git a/Applications/VK.app/Icon.pic b/Applications/VK.app/Icon.pic index 82c19748..56648abf 100644 Binary files a/Applications/VK.app/Icon.pic and b/Applications/VK.app/Icon.pic differ diff --git a/Applications/VK.app/Icons/Comments.pic b/Applications/VK.app/Icons/Comments.pic index 13b8c862..89e4a805 100644 Binary files a/Applications/VK.app/Icons/Comments.pic and b/Applications/VK.app/Icons/Comments.pic differ diff --git a/Applications/VK.app/Icons/Likes.pic b/Applications/VK.app/Icons/Likes.pic index 3fabfb07..196c6e1c 100644 Binary files a/Applications/VK.app/Icons/Likes.pic and b/Applications/VK.app/Icons/Likes.pic differ diff --git a/Applications/VK.app/Icons/Reposts.pic b/Applications/VK.app/Icons/Reposts.pic index 63b832e8..7ee37447 100644 Binary files a/Applications/VK.app/Icons/Reposts.pic and b/Applications/VK.app/Icons/Reposts.pic differ diff --git a/Applications/VK.app/Icons/Views.pic b/Applications/VK.app/Icons/Views.pic index 0c16fe1c..3844ff57 100644 Binary files a/Applications/VK.app/Icons/Views.pic and b/Applications/VK.app/Icons/Views.pic differ diff --git a/Applications/VK.app/Localizations/Dutch.lang b/Applications/VK.app/Localizations/Dutch.lang index 88730cb5..f85de603 100644 --- a/Applications/VK.app/Localizations/Dutch.lang +++ b/Applications/VK.app/Localizations/Dutch.lang @@ -8,6 +8,8 @@ username = "E-mail of telefoon nummer", password = "Wachtwoord", login = "Log in", + twoFactorEnabled = "2FA enthalten", + twoFactor = "2FA code", saveLogin = "Sla login informatie op:", loadCountConversations = "Het aantal geladen dialogen", diff --git a/Applications/VK.app/Localizations/English.lang b/Applications/VK.app/Localizations/English.lang index 46dfed2b..8f2fc0d4 100644 --- a/Applications/VK.app/Localizations/English.lang +++ b/Applications/VK.app/Localizations/English.lang @@ -8,6 +8,8 @@ username = "E-mail or phone number", password = "Password", login = "Enter", + twoFactorEnabled = "Use 2FA", + twoFactor = "2FA code", saveLogin = "Save login information:", loadCountConversations = "The number of loaded dialogues", diff --git a/Applications/VK.app/Localizations/Russian.lang b/Applications/VK.app/Localizations/Russian.lang index 7923e087..ef1ec6d2 100644 --- a/Applications/VK.app/Localizations/Russian.lang +++ b/Applications/VK.app/Localizations/Russian.lang @@ -8,6 +8,8 @@ username = "E-mail или номер телефона", password = "Пароль", login = "Войти", + twoFactorEnabled = "Использовать 2FA", + twoFactor = "Код 2FA", saveLogin = "Сохранять данные входа:", loadCountConversations = "Число загружаемых диалогов", diff --git a/Applications/VK.app/Main.lua b/Applications/VK.app/Main.lua index 2e74f6ff..af99de5f 100644 --- a/Applications/VK.app/Main.lua +++ b/Applications/VK.app/Main.lua @@ -120,7 +120,8 @@ local function request(url, postData, headers) return data else - GUI.alert("Failed to perform internet request: " .. tostring(reason)) + --GUI.alert("Failed to perform internet request: " .. tostring(reason)) + return nil, reason end end @@ -1668,6 +1669,9 @@ local function login() logo.height = logo.height + 1 local usernameInput = layout:addChild(GUI.input(1, 1, 36, 3, style.UIInputBackground, style.UIInputForeground, style.UIInputPlaceholder, style.UIInputBackground, style.UIInputFocusedForeground, config.username or "", localization.username)) local passwordInput = layout:addChild(GUI.input(1, 1, 36, 3, style.UIInputBackground, style.UIInputForeground, style.UIInputPlaceholder, style.UIInputBackground, style.UIInputFocusedForeground, config.password or "", localization.password, true, "•")) + local twoFactorSwitch = layout:addChild(GUI.switchAndLabel(1, 1, 36, 6, style.UISwitchActive, style.UISwitchPassive, style.UISwitchPipe, style.UIText, localization.twoFactorEnabled, false)) + local twoFactorInput = layout:addChild(GUI.input(1, 1, 36, 3, style.UIInputBackground, style.UIInputForeground, style.UIInputPlaceholder, style.UIInputBackground, style.UIInputFocusedForeground, config.twoFactor or "", localization.twoFactor)) + twoFactorInput.hidden = true local loginButton = layout:addChild(GUI.button(1, 1, 36, 3, style.UIButtonDefaultBackground, style.UIButtonDefaultForeground, style.UIButtonPressedBackground, style.UIButtonPressedForeground, localization.login)) loginButton.colors.disabled = { background = style.UIButtonDisabledBackground, @@ -1678,13 +1682,19 @@ local function login() loginusernameInput.hidden = true usernameInput.onInputFinished = function() - loginButton.disabled = #usernameInput.text == 0 or #passwordInput.text == 0 + loginButton.disabled = #usernameInput.text == 0 or #passwordInput.text == 0 or twoFactorSwitch.switch.state and #twoFactorInput.text == 0 workspace:draw() end passwordInput.onInputFinished = usernameInput.onInputFinished + twoFactorInput.onInputFinished = usernameInput.onInputFinished + + twoFactorSwitch.switch.onStateChanged = function() + twoFactorInput.hidden = not twoFactorSwitch.switch.state + usernameInput.onInputFinished() + end loginButton.onTouch = function() - local result, reason = request("https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username=" .. internet.encode(usernameInput.text) .. "&password=" .. internet.encode(passwordInput.text) .. "&v=" .. VKAPIVersion) + local result, reason = request("https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&2fa_supported=1&username=" .. internet.encode(usernameInput.text) .. "&password=" .. internet.encode(passwordInput.text) .. "&code=" .. twoFactorInput.text .. "&v=" .. VKAPIVersion) if result then if result.access_token then currentAccessToken = result.access_token @@ -1701,6 +1711,8 @@ local function login() end saveConfig() + else + GUI.alert("An error occurred while logging in: " .. reason) end end diff --git a/Applications/VK.app/Styles/Bright.lua b/Applications/VK.app/Styles/Bright.lua index eee52652..f9c3cc8e 100644 --- a/Applications/VK.app/Styles/Bright.lua +++ b/Applications/VK.app/Styles/Bright.lua @@ -49,7 +49,7 @@ UIBackground = 0xF0F0F0, UITitle = 0x3C3C3C, UIText = 0xB4B4B4, - UISliderPrimary = 0x99DBFF, + UISliderPrimary = 0x00B6FF, UISliderSecondary = 0xE1E1E1, UISliderPipe = 0xFFFFFF, UISliderValue = 0xA5A5A5, @@ -58,13 +58,13 @@ UIComboBoxArrowBackground = 0xD2D2D2, UIComboBoxArrowForeground = 0x969696, UIProgressIndicatorPassive = 0xD2D2D2, - UIProgressIndicatorPrimary = 0x33B6FF, - UIProgressIndicatorSecondary = 0x99DBFF, + UIProgressIndicatorPrimary = 0x00B6FF, + UIProgressIndicatorSecondary = 0x006DFF, UIInputBackground = 0xE1E1E1, UIInputForeground = 0x787878, UIInputPlaceholder = 0xA5A5A5, UIInputFocusedForeground = 0x787878, - UISwitchActive = 0x99DBFF, + UISwitchActive = 0x00B6FF, UISwitchPassive = 0xD2D2D2, UISwitchPipe = 0xFFFFFF, UIButtonDefaultBackground = 0xD2D2D2, diff --git a/Applications/VK.app/Styles/Dark.lua b/Applications/VK.app/Styles/Dark.lua index 1da33a01..231a0704 100644 --- a/Applications/VK.app/Styles/Dark.lua +++ b/Applications/VK.app/Styles/Dark.lua @@ -49,7 +49,7 @@ UIBackground = 0x2D2D2D, UITitle = 0xE1E1E1, UIText = 0x5A5A5A, - UISliderPrimary = 0xCC92FF, + UISliderPrimary = 0x006DFF, UISliderSecondary = 0x2D2D2D, UISliderPipe = 0xFFFFFF, UISliderValue = 0x696969, @@ -58,13 +58,13 @@ UIComboBoxArrowBackground = 0x5A5A5A, UIComboBoxArrowForeground = 0xE1E1E1, UIProgressIndicatorPassive = 0x1E1E1E, - UIProgressIndicatorPrimary = 0x662480, - UIProgressIndicatorSecondary = 0xCC92FF, + UIProgressIndicatorPrimary = 0x006DFF, + UIProgressIndicatorSecondary = 0x00B6FF, UIInputBackground = 0x3C3C3C, UIInputForeground = 0x878787, UIInputPlaceholder = 0x5A5A5A, UIInputFocusedForeground = 0xA5A5A5, - UISwitchActive = 0x664980, + UISwitchActive = 0x00B6FF, UISwitchPassive = 0xD2D2D2, UISwitchPipe = 0xFFFFFF, UIButtonDefaultBackground = 0x4B4B4B,