mirror of
https://github.com/puppe/moneymoney-uberspace.git
synced 2025-12-20 01:12:17 +01:00
conditional login logic
if username contains "|" the username should be split into email and username. if not, continue as before
This commit is contained in:
parent
25e09cf0b9
commit
dc31c4bdd7
1 changed files with 15 additions and 11 deletions
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
WebBanking{version = 1.02,
|
WebBanking{version = 1.02,
|
||||||
url = 'https://dashboard.uberspace.de/login',
|
url = 'https://dashboard.uberspace.de/login',
|
||||||
services = {'Uberspace.de metauser'},
|
services = {'Uberspace.de'},
|
||||||
description = string.format(
|
description = string.format(
|
||||||
MM.localizeText("Get balance and transactions for %s"),
|
MM.localizeText("Get balance and transactions for %s"),
|
||||||
"Uberspace.de metauser")
|
"Uberspace.de")
|
||||||
}
|
}
|
||||||
|
|
||||||
function SupportsBank (protocol, bankCode)
|
function SupportsBank (protocol, bankCode)
|
||||||
return bankCode == 'Uberspace.de metauser' and protocol == ProtocolWebBanking
|
return bankCode == 'Uberspace.de' and protocol == ProtocolWebBanking
|
||||||
end
|
end
|
||||||
|
|
||||||
local usConnection = Connection()
|
local usConnection = Connection()
|
||||||
|
|
@ -22,20 +22,24 @@ local usUsername
|
||||||
function InitializeSession (protocol, bankCode, username, username2,
|
function InitializeSession (protocol, bankCode, username, username2,
|
||||||
password, username3)
|
password, username3)
|
||||||
|
|
||||||
-- Split the input into email and username based on '|'
|
-- Check if the username contains '|'
|
||||||
local splitPos = username:find("|")
|
local splitPos = username:find("|")
|
||||||
if not splitPos then
|
|
||||||
return "Failed to log in. Please check that the username includes both email and username separated by '|'."
|
if splitPos then
|
||||||
|
-- If `|` is found, split into email and username
|
||||||
|
usLogin = username:sub(1, splitPos - 1)
|
||||||
|
usUsername = username:sub(splitPos + 1)
|
||||||
|
else
|
||||||
|
-- If no `|` is found, use the entire value as both email and username
|
||||||
|
usLogin = username
|
||||||
|
usUsername = username
|
||||||
end
|
end
|
||||||
|
|
||||||
usEmail = username:sub(1, splitPos - 1)
|
|
||||||
usUsername = username:sub(splitPos + 1)
|
|
||||||
|
|
||||||
-- Login.
|
-- Login.
|
||||||
usUsername = usEmail
|
usUsername = usLogin
|
||||||
|
|
||||||
html = HTML(usConnection:get('https://dashboard.uberspace.de/login'))
|
html = HTML(usConnection:get('https://dashboard.uberspace.de/login'))
|
||||||
html:xpath('//input[@name="login"]'):attr('value', usEmail)
|
html:xpath('//input[@name="login"]'):attr('value', usLogin)
|
||||||
html:xpath('//input[@name="password"]'):attr('value', password)
|
html:xpath('//input[@name="password"]'):attr('value', password)
|
||||||
|
|
||||||
html = HTML(
|
html = HTML(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue