2019-05-17 20:22:01 +02:00
|
|
|
using MD5
|
|
|
|
using HTTP
|
2019-05-19 22:24:18 +02:00
|
|
|
using JSON2
|
|
|
|
|
2019-05-17 20:22:01 +02:00
|
|
|
function getlogin(app, req)
|
|
|
|
query = HTTP.URIs.queryparams(req[:query])
|
2019-05-21 11:05:53 +02:00
|
|
|
req[:login] = Dict(:name => string(get(query, "u", "")),
|
|
|
|
:token => get(query, "t", ""),
|
|
|
|
:salt => get(query, "s", ""),
|
|
|
|
:password => get(query, "p", ""),
|
2019-05-17 20:22:01 +02:00
|
|
|
:login => false)
|
|
|
|
return app(req)
|
|
|
|
end
|
|
|
|
|
|
|
|
function checkpassword(app, req)
|
2019-05-21 11:05:53 +02:00
|
|
|
user = JlSonic.checkpass(req[:login][:name],
|
|
|
|
req[:login][:salt],
|
|
|
|
req[:login][:token],
|
|
|
|
req[:login][:password])
|
|
|
|
if user == nothing
|
|
|
|
req[:login][:login] = false
|
|
|
|
else
|
|
|
|
req[:login][:login] = true
|
|
|
|
req[:login][:user] = user
|
2019-05-17 20:22:01 +02:00
|
|
|
end
|
|
|
|
return app(req)
|
|
|
|
end
|
|
|
|
|
|
|
|
sonic_login = stack(getlogin, checkpassword)
|