From 6b1d82bded5011801cc11bd698ba3a2ae1bf50c0 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 9 Apr 2023 17:19:54 -0500 Subject: [PATCH] Do not ask for password if none is provided --- actix/Cargo.lock | 2 +- actix/Cargo.toml | 2 +- actix/src/auth.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/actix/Cargo.lock b/actix/Cargo.lock index b3c1c13..25a0a70 100644 --- a/actix/Cargo.lock +++ b/actix/Cargo.lock @@ -1136,7 +1136,7 @@ dependencies = [ [[package]] name = "simply-shorten" -version = "4.0.0" +version = "4.0.1" dependencies = [ "actix-files", "actix-session", diff --git a/actix/Cargo.toml b/actix/Cargo.toml index ec81ea8..cc50d0a 100644 --- a/actix/Cargo.toml +++ b/actix/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simply-shorten" -version = "4.0.0" +version = "4.0.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/actix/src/auth.rs b/actix/src/auth.rs index fd9b612..9d57339 100644 --- a/actix/src/auth.rs +++ b/actix/src/auth.rs @@ -1,7 +1,12 @@ use actix_session::Session; -use std::time::SystemTime; +use std::{env, time::SystemTime}; pub fn validate(session: Session) -> bool { + // If there's no password provided, just return true + if env::var("password").is_err() { + return true; + } + let token = session.get::("session-token"); if token.is_err() { false