Skip to content

Commit 8590dd6

Browse files
committed
move random string to util mod and remvoe secure file
1 parent a1b13a1 commit 8590dd6

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

pgml-dashboard/src/templates/docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl NavLink {
2121
/// Create a new documentation link.
2222
pub fn new(title: &str) -> NavLink {
2323
NavLink {
24-
id: crate::utils::secure::random_string(25),
24+
id: crate::utils::random_string(25),
2525
title: title.to_string(),
2626
href: "#".to_string(),
2727
children: vec![],

pgml-dashboard/src/utils/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl<'a> Tab<'a> {
586586
Tab {
587587
children: vec![],
588588
name,
589-
id: crate::utils::secure::random_string(10),
589+
id: crate::utils::random_string(10),
590590
active: false,
591591
}
592592
}

pgml-dashboard/src/utils/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
pub mod config;
22
pub mod datadog;
33
pub mod markdown;
4-
pub mod secure;
54
pub mod tabs;
65
pub mod time;
6+
7+
use rand::{distributions::Alphanumeric, Rng};
8+
9+
/// Generate a random string of any length.
10+
pub fn random_string(len: usize) -> String {
11+
rand::thread_rng()
12+
.sample_iter(&Alphanumeric)
13+
.take(len)
14+
.map(char::from)
15+
.collect()
16+
}

pgml-dashboard/src/utils/secure.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy