From 6ff579b586bef0bca1e6b4bc7d7b8247059bf94b Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Fri, 18 Oct 2019 15:56:11 +0200 Subject: [PATCH] Return forbidden if user is not logged for /ui/is_logged_in. Closes: #119 --- src/daemon/auth.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/daemon/auth.rs b/src/daemon/auth.rs index 3ba96fd7..a73f8af5 100644 --- a/src/daemon/auth.rs +++ b/src/daemon/auth.rs @@ -50,8 +50,12 @@ pub fn logout(id: Identity) -> HttpResponse { HttpResponse::Ok().finish() } -pub fn is_logged_in(_auth: Auth) -> HttpResponse { - HttpResponse::Ok().finish() +pub fn is_logged_in(id: Identity) -> HttpResponse { + if id.identity().is_some() { + HttpResponse::Ok().finish() + } else { + HttpResponse::Forbidden() + } } pub type UserName = String;