If authentication is recieved, it's now also correctly validated

CURA-49
This commit is contained in:
Jaime van Kessel 2016-06-29 11:53:56 +02:00
parent 3a767c72f0
commit 054f7aaa83

View file

@ -335,15 +335,13 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
data = json.loads(bytes(reply.readAll()).decode("utf-8")) data = json.loads(bytes(reply.readAll()).decode("utf-8"))
print("auth check response") print("auth check response")
if data.get("message", "") == "authorized": if data.get("message", "") == "authorized":
Logger.log("i", "Authentication completed.") Logger.log("i", "Authentication was approved")
self.setAuthenticationState(AuthState.Authenticated) self._verifyAuthentication() # Ensure that the verification is really used and correct.
elif data.get("message", "") == "unauthorized": elif data.get("message", "") == "unauthorized":
Logger.log("i", "Authentication was denied.") Logger.log("i", "Authentication was denied.")
self.setAuthenticationState(AuthState.AuthenticationDenied) self.setAuthenticationState(AuthState.AuthenticationDenied)
else: else:
pass pass
#Logger.log("i", "Authentication was denied.")
#self.setAuthenticationState(AuthState.AuthenticationDenied)
elif reply.operation() == QNetworkAccessManager.PostOperation: elif reply.operation() == QNetworkAccessManager.PostOperation:
if "/auth/request" in reply.url().toString(): if "/auth/request" in reply.url().toString():