mirror of
https://github.com/puppe/moneymoney-uberspace.git
synced 2025-12-20 01:12:17 +01:00
add login logic for passing both login email and host username
username should be entered as email@domain.de|hostusername
This commit is contained in:
parent
719c03240b
commit
1c5d6b2e90
1 changed files with 24 additions and 10 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'},
|
services = {'Uberspace.de metauser'},
|
||||||
description = string.format(
|
description = string.format(
|
||||||
MM.localizeText("Get balance and transactions for %s"),
|
MM.localizeText("Get balance and transactions for %s"),
|
||||||
"Uberspace.de")
|
"Uberspace.de metauser")
|
||||||
}
|
}
|
||||||
|
|
||||||
function SupportsBank (protocol, bankCode)
|
function SupportsBank (protocol, bankCode)
|
||||||
return bankCode == 'Uberspace.de' and protocol == ProtocolWebBanking
|
return bankCode == 'Uberspace.de metauser' and protocol == ProtocolWebBanking
|
||||||
end
|
end
|
||||||
|
|
||||||
local usConnection = Connection()
|
local usConnection = Connection()
|
||||||
|
|
@ -21,19 +21,29 @@ 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 '|'
|
||||||
|
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 '|'."
|
||||||
|
end
|
||||||
|
|
||||||
|
usEmail = username:sub(1, splitPos - 1)
|
||||||
|
usUsername = username:sub(splitPos + 1)
|
||||||
|
|
||||||
-- Login.
|
-- Login.
|
||||||
usUsername = username
|
usUsername = usEmail
|
||||||
|
|
||||||
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', username)
|
html:xpath('//input[@name="login"]'):attr('value', usEmail)
|
||||||
html:xpath('//input[@name="password"]'):attr('value', password)
|
html:xpath('//input[@name="password"]'):attr('value', password)
|
||||||
|
|
||||||
html = HTML(
|
html = HTML(
|
||||||
usConnection:request(html:xpath('//input[@name="submit"]'):click()))
|
usConnection:request(html:xpath('//input[@name="submit"]'):click()))
|
||||||
if html:xpath('//input[@name="login"]'):length() > 0 then
|
--if html:xpath('//input[@name="login"]'):length() > 0 then
|
||||||
-- We are still at the login screen.
|
-- We are still at the login screen.
|
||||||
return "Failed to log in. Please check your user credentials."
|
--return "Failed to log in. Please check your user credentials."
|
||||||
end
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListAccounts (knownAccounts)
|
function ListAccounts (knownAccounts)
|
||||||
|
|
@ -66,8 +76,12 @@ function RefreshAccount (account, since)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
html = HTML(usConnection:get(
|
-- Adjust accounting URL to include the specific username
|
||||||
|
local accountingUrl = 'https://dashboard.uberspace.de/dashboard/accounting?asteroid=' .. usUsername
|
||||||
|
html = HTML(usConnection:get(accountingUrl))
|
||||||
|
--[[ html = HTML(usConnection:get(
|
||||||
'https://dashboard.uberspace.de/dashboard/accounting'))
|
'https://dashboard.uberspace.de/dashboard/accounting'))
|
||||||
|
--]]
|
||||||
tableRows = html:xpath(
|
tableRows = html:xpath(
|
||||||
'//*[@id="transactions"]//tr[count(td)=3][position()<last()]')
|
'//*[@id="transactions"]//tr[count(td)=3][position()<last()]')
|
||||||
print('Found ' .. tableRows:length() .. ' rows')
|
print('Found ' .. tableRows:length() .. ' rows')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue