mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-09-28 22:32:01 +00:00
19 lines
504 B
Rust
19 lines
504 B
Rust
use heck::CamelCase;
|
|
use rocket::{
|
|
http::uri::Uri,
|
|
response::{Redirect, Flash}
|
|
};
|
|
|
|
/// Remove non alphanumeric characters and CamelCase a string
|
|
pub fn make_actor_id(name: String) -> String {
|
|
name.as_str()
|
|
.to_camel_case()
|
|
.to_string()
|
|
.chars()
|
|
.filter(|c| c.is_alphanumeric())
|
|
.collect()
|
|
}
|
|
|
|
pub fn requires_login(message: &str, url: &str) -> Flash<Redirect> {
|
|
Flash::new(Redirect::to(Uri::new(format!("/login?m={}", message))), "callback", url)
|
|
}
|