Fix login issue (#401)

Regression introduced by 4059a840be
This commit is contained in:
fdb-hiroshima 2018-12-31 11:45:59 +01:00 committed by GitHub
parent 3128e6a3b9
commit 2896eb1705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -47,9 +47,9 @@ pub fn create(conn: DbConn, form: LenientForm<LoginForm>, flash: Option<FlashMes
let mut err = ValidationError::new("invalid_login"); let mut err = ValidationError::new("invalid_login");
err.message = Some(Cow::from("Invalid username or password")); err.message = Some(Cow::from("Invalid username or password"));
errors.add("email_or_name", err); errors.add("email_or_name", err);
user.id.to_string()
} else {
String::new() String::new()
} else {
user.id.to_string()
} }
} else { } else {
// Fake password verification, only to avoid different login times // Fake password verification, only to avoid different login times
@ -66,7 +66,6 @@ pub fn create(conn: DbConn, form: LenientForm<LoginForm>, flash: Option<FlashMes
cookies.add_private(Cookie::build(AUTH_COOKIE, user_id) cookies.add_private(Cookie::build(AUTH_COOKIE, user_id)
.same_site(SameSite::Lax) .same_site(SameSite::Lax)
.finish()); .finish());
let destination = flash let destination = flash
.and_then(|f| if f.name() == "callback" { .and_then(|f| if f.name() == "callback" {
Some(f.msg().to_owned()) Some(f.msg().to_owned())