Fixes an error client.

ipc07
Luka Vandervelden 2019-12-19 03:58:00 +01:00
parent c605c9fadf
commit e8ace8a6eb
2 changed files with 2 additions and 4 deletions

View File

@ -318,7 +318,7 @@ module AuthD
end end
end end
def get_user?(login : String, password : String) : Passwd::User? def get_user?(login : String, password : String) : AuthD::User::Public?
send Request::GetUserByCredentials.new login, password send Request::GetUserByCredentials.new login, password
response = Response.from_ipc read response = Response.from_ipc read

View File

@ -17,13 +17,11 @@ class AuthD::Token
end end
def to_s(key) def to_s(key)
JWT.encode to_h.to_json, key, JWT::Algorithm::HS256 JWT.encode to_h, key, JWT::Algorithm::HS256
end end
def self.from_s(key, str) def self.from_s(key, str)
payload, meta = JWT.decode str, key, JWT::Algorithm::HS256 payload, meta = JWT.decode str, key, JWT::Algorithm::HS256
puts "PAYLOAD BELOW, BEWARE"
pp! payload
self.new payload["login"].as_s, payload["uid"].as_i self.new payload["login"].as_s, payload["uid"].as_i
end end