vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit de72655bb11246b6b4b4c0debfd4ff381ff552e1
parent 4a2350891a2e9ebc430873fadaac088d0d728361
Author: Miroslav Prasil <miroslav@prasil.info>
Date:   Mon, 16 Jul 2018 10:23:45 +0100

Add confirmed check to the OrgHeaders request guard

Diffstat:
Msrc/auth.rs | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/auth.rs b/src/auth.rs @@ -95,7 +95,7 @@ use rocket::Outcome; use rocket::request::{self, Request, FromRequest}; use db::DbConn; -use db::models::{User, UserOrganization, UserOrgType, Device}; +use db::models::{User, UserOrganization, UserOrgType, UserOrgStatus, Device}; pub struct Headers { pub host: String, @@ -205,7 +205,13 @@ impl<'a, 'r> FromRequest<'a, 'r> for OrgHeaders { }; let org_user = match UserOrganization::find_by_user_and_org(&headers.user.uuid, &org_id, &conn) { - Some(user) => user, + Some(user) => { + if user.status == UserOrgStatus::Confirmed as i32 { + user + } else { + err_handler!("The current user isn't confirmed member of the organization") + } + } None => err_handler!("The current user isn't member of the organization") };