2018-04-23 10:54:37 +00:00
|
|
|
use heck::CamelCase;
|
2018-04-23 14:25:39 +00:00
|
|
|
use rocket::response::Redirect;
|
2018-04-23 10:54:37 +00:00
|
|
|
|
2018-04-23 11:10:15 +00:00
|
|
|
/// Remove non alphanumeric characters and CamelCase a string
|
2018-04-23 10:54:37 +00:00
|
|
|
pub fn make_actor_id(name: String) -> String {
|
2018-04-23 11:10:15 +00:00
|
|
|
name.as_str()
|
|
|
|
.to_camel_case()
|
|
|
|
.to_string()
|
|
|
|
.chars()
|
|
|
|
.filter(|c| c.is_alphanumeric())
|
|
|
|
.collect()
|
2018-04-23 10:54:37 +00:00
|
|
|
}
|
2018-04-23 14:25:39 +00:00
|
|
|
|
|
|
|
pub fn requires_login() -> Redirect {
|
|
|
|
Redirect::to("/login")
|
|
|
|
}
|