Plume/templates/session/login.rs.html
Ana Gelez 8ab690001d Replace the input! macro with an Input builder (#646)
* Replace the input! macro with an Input builder

* Use a BTreeMap instead of an HashMap

Followinf @fdb-hiroshima's advice

* Rename Input::to_html to Input::html

To make clippy happy

* Wrap error messages in red paragraphs
2019-08-27 16:50:24 +02:00

30 lines
1023 B
HTML

@use template_utils::*;
@use templates::base;
@use validator::ValidationErrors;
@use routes::session::LoginForm;
@use routes::*;
@(ctx: BaseContext, message: Option<String>, form: &LoginForm, errors: ValidationErrors)
@:base(ctx, i18n!(ctx.1, "Log in"), {}, {}, {
<h1>@i18n!(ctx.1, "Log in")</h1>
@if let Some(message) = message {
<p>@message</p>
}
<form method="post" action="@uri!(session::create)">
@(Input::new("email_or_name", i18n!(ctx.1, "Username, or email"))
.default(&form.email_or_name)
.error(&errors)
.set_prop("minlenght", 1)
.html(ctx.1))
@(Input::new("password", i18n!(ctx.1, "Password"))
.default(&form.password)
.error(&errors)
.set_prop("minlenght", 8)
.input_type("password")
.html(ctx.1))
<input type="submit" value="@i18n!(ctx.1, "Log in")" />
</form>
<a href="@uri!(session::password_reset_request_form)">Forgot your password?</a>
})