Encode redirect messages into valid url data (#409)

Ref #408
This commit is contained in:
fdb-hiroshima 2019-01-05 19:36:55 +01:00 committed by GitHub
parent 2993379aaf
commit c502ae73f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ pub fn make_actor_id(name: &str) -> String {
* Note that the message should be translated before passed to this function. * Note that the message should be translated before passed to this function.
*/ */
pub fn requires_login<T: Into<Uri<'static>>>(message: &str, url: T) -> Flash<Redirect> { pub fn requires_login<T: Into<Uri<'static>>>(message: &str, url: T) -> Flash<Redirect> {
Flash::new(Redirect::to(format!("/login?m={}", message)), "callback", url.into().to_string()) Flash::new(Redirect::to(format!("/login?m={}", Uri::percent_encode(message))), "callback", url.into().to_string())
} }
#[derive(Debug)] #[derive(Debug)]