Show organizations in admin panel, implement reload templates option

This commit is contained in:
Daniel García
2019-01-20 17:43:56 +01:00
parent a797459560
commit bfd93e5b13
5 changed files with 56 additions and 9 deletions

View File

@ -49,7 +49,7 @@ impl AdminTemplateData {
}
fn render(self) -> Result<String, Error> {
CONFIG.templates.render("admin/base", &self).map_err(Into::into)
CONFIG.render_template("admin/base", &self)
}
}
@ -72,6 +72,7 @@ struct LoginForm {
fn post_admin_login(data: Form<LoginForm>, mut cookies: Cookies, ip: ClientIp) -> Result<Redirect, Flash<Redirect>> {
let data = data.into_inner();
// If the token is invalid, redirect to login page
if !_validate_token(&data.token) {
error!("Invalid admin token. IP: {}", ip.ip);
Err(Flash::error(