2022-01-06 11:18:20 +00:00
|
|
|
@use std::borrow::Cow;
|
|
|
|
@use validator::{ValidationErrors, ValidationErrorsKind};
|
|
|
|
@use crate::templates::base;
|
|
|
|
@use crate::template_utils::*;
|
|
|
|
@use crate::routes::email_signups::EmailSignupForm;
|
|
|
|
@use crate::routes::*;
|
|
|
|
|
|
|
|
@(ctx: BaseContext, enabled: bool, form: &EmailSignupForm, errors: ValidationErrors)
|
|
|
|
|
|
|
|
@:base(ctx, i18n!(ctx.1, "Create your account"), {}, {}, {
|
|
|
|
@if enabled {
|
|
|
|
<h1>@i18n!(ctx.1, "Create an account")</h1>
|
|
|
|
<form method="post" action="@uri!(email_signups::create)">
|
|
|
|
@if let Some(ValidationErrorsKind::Field(errs)) = errors.clone().errors().get("__all__") {
|
|
|
|
<p class="error">@errs[0].message.as_ref().unwrap_or(&Cow::from("Unknown error"))</p>
|
|
|
|
}
|
|
|
|
|
|
|
|
@(Input::new("email", i18n!(ctx.1, "Email"))
|
|
|
|
.input_type("email")
|
|
|
|
.default(&form.email)
|
|
|
|
.error(&errors)
|
|
|
|
.set_prop("required", "")
|
|
|
|
.html(ctx.1))
|
|
|
|
|
|
|
|
@(Input::new("email_confirmation", i18n!(ctx.1, "Email confirmation"))
|
|
|
|
.input_type("email")
|
|
|
|
.default(&form.email_confirmation)
|
|
|
|
.error(&errors)
|
|
|
|
.set_prop("required", "")
|
|
|
|
.html(ctx.1))
|
|
|
|
|
2022-01-26 13:10:14 +00:00
|
|
|
<p>@i18n!(ctx.1, "An email will be sent to provided email. You can continue signing-up via the email.")</p>
|
|
|
|
|
2022-01-06 11:18:20 +00:00
|
|
|
<input type="submit" value="@i18n!(ctx.1, "Create your account")" />
|
|
|
|
</form>
|
|
|
|
} else {
|
2022-01-26 13:09:45 +00:00
|
|
|
<p class="center">@i18n!(ctx.1, "Apologies, but registrations are closed on this particular instance. You can, however, find a different one.")</p>
|
2022-01-06 11:18:20 +00:00
|
|
|
}
|
|
|
|
})
|