From 6d735806c04b7334eddcfdc7935d0b21d799b1d4 Mon Sep 17 00:00:00 2001 From: Stepan Fedorko-Bartos Date: Thu, 15 Nov 2018 18:58:44 -0700 Subject: [PATCH] Ensures Yubico Creds are set when opening Yubikey Modal --- src/api/core/two_factor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/core/two_factor.rs b/src/api/core/two_factor.rs index 7e09e225..59b2a0c9 100644 --- a/src/api/core/two_factor.rs +++ b/src/api/core/two_factor.rs @@ -578,6 +578,11 @@ fn verify_yubikey_otp(otp: String) -> JsonResult { #[post("/two-factor/get-yubikey", data = "")] fn generate_yubikey(data: JsonUpcase, headers: Headers, conn: DbConn) -> JsonResult { + if !CONFIG.yubico_cred_set { + err!("`YUBICO_CLIENT_ID` or `YUBICO_SECRET_KEY` environment variable is not set. \ + Yubikey OTP Disabled") + } + let data: PasswordData = data.into_inner().data; if !headers.user.check_valid_password(&data.MasterPasswordHash) {