1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-25 23:28:37 -06:00

Do not ask for password if none is provided

This commit is contained in:
Sayantan Santra 2023-04-09 17:19:54 -05:00
parent 3e07e9aadb
commit 6b1d82bded
3 changed files with 8 additions and 3 deletions

2
actix/Cargo.lock generated
View file

@ -1136,7 +1136,7 @@ dependencies = [
[[package]]
name = "simply-shorten"
version = "4.0.0"
version = "4.0.1"
dependencies = [
"actix-files",
"actix-session",

View file

@ -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

View file

@ -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::<String>("session-token");
if token.is_err() {
false