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
This commit is contained in:
@@ -12,8 +12,17 @@
|
||||
<p>@message</p>
|
||||
}
|
||||
<form method="post" action="@uri!(session::create)">
|
||||
@input!(ctx.1, email_or_name (text), "Username, or email", form, errors.clone(), "minlenght=\"1\"")
|
||||
@input!(ctx.1, password (password), "Password", form, errors, "minlenght=\"1\"")
|
||||
@(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>
|
||||
|
||||
@@ -9,8 +9,18 @@
|
||||
<h1>@i18n!(ctx.1, "Reset your password")</h1>
|
||||
|
||||
<form method="POST">
|
||||
@input!(ctx.1, password (password), "New password", form, errors.clone(), "minlenght=\"8\"")
|
||||
@input!(ctx.1, password_confirmation (password), "Confirmation", form, errors.clone(), "minlenght=\"8\"")
|
||||
@(Input::new("password", i18n!(ctx.1, "New password"))
|
||||
.default(&form.password)
|
||||
.error(&errors)
|
||||
.set_prop("minlenght", 8)
|
||||
.input_type("password")
|
||||
.html(ctx.1))
|
||||
@(Input::new("password_confirmation", i18n!(ctx.1, "Confirmation"))
|
||||
.default(&form.password_confirmation)
|
||||
.error(&errors)
|
||||
.set_prop("minlenght", 8)
|
||||
.input_type("password")
|
||||
.html(ctx.1))
|
||||
<input type="submit" value="@i18n!(ctx.1, "Update password")" />
|
||||
</form>
|
||||
})
|
||||
|
||||
@@ -9,7 +9,12 @@
|
||||
<h1>@i18n!(ctx.1, "Reset your password")</h1>
|
||||
|
||||
<form method="POST">
|
||||
@input!(ctx.1, email (email), "E-mail", form, errors.clone(), "minlenght=\"1\"")
|
||||
@(Input::new("email", i18n!(ctx.1, "Email"))
|
||||
.default(&form.email)
|
||||
.error(&errors)
|
||||
.set_prop("minlenght", 1)
|
||||
.input_type("email")
|
||||
.html(ctx.1))
|
||||
<input type="submit" value="@i18n!(ctx.1, "Send password reset link")" />
|
||||
</form>
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user