mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 09:16:46 +00:00
Do not ask for password if none is provided
This commit is contained in:
parent
3e07e9aadb
commit
6b1d82bded
2
actix/Cargo.lock
generated
2
actix/Cargo.lock
generated
@ -1136,7 +1136,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simply-shorten"
|
name = "simply-shorten"
|
||||||
version = "4.0.0"
|
version = "4.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-session",
|
"actix-session",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "simply-shorten"
|
name = "simply-shorten"
|
||||||
version = "4.0.0"
|
version = "4.0.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
use actix_session::Session;
|
use actix_session::Session;
|
||||||
use std::time::SystemTime;
|
use std::{env, time::SystemTime};
|
||||||
|
|
||||||
pub fn validate(session: Session) -> bool {
|
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");
|
let token = session.get::<String>("session-token");
|
||||||
if token.is_err() {
|
if token.is_err() {
|
||||||
false
|
false
|
||||||
|
Loading…
Reference in New Issue
Block a user