Fail suspended logins

This commit is contained in:
Alex Wright 2020-03-01 21:31:38 +01:00
parent 7f59729f1f
commit 6548aa0b7e
1 changed files with 3 additions and 0 deletions

View File

@ -159,6 +159,9 @@ fn login(form_data: Form<LoginData>, conn: AuthDb) -> Result<Redirect, Flash<Red
Ok(user) => user,
_ => return Err(Flash::error(Redirect::to(uri!(login_form)), "Failed to fetch user")),
};
if ! user.is_active {
return Err(Flash::error(Redirect::to(uri!(login_form)), "Account is suspended"));
}
println!("User: {:?}", user);
Ok(Redirect::to("/"))