2018-12-06 18:54:16 +01:00
|
|
|
@use templates::base;
|
|
|
|
@use template_utils::*;
|
|
|
|
@use routes::user::UpdateUserForm;
|
|
|
|
@use validator::ValidationErrors;
|
2018-12-07 12:05:01 +01:00
|
|
|
@use routes::*;
|
2018-12-06 18:54:16 +01:00
|
|
|
|
|
|
|
@(ctx: BaseContext, form: UpdateUserForm, errors: ValidationErrors)
|
|
|
|
|
2019-02-02 15:23:50 +01:00
|
|
|
@:base(ctx, i18n!(ctx.1, "Edit your account"), {}, {}, {
|
2018-12-07 12:05:01 +01:00
|
|
|
@if let Some(u) = ctx.2.clone() {
|
|
|
|
<h1>@i18n!(ctx.1, "Your Profile")</h1>
|
2019-03-06 14:11:36 +01:00
|
|
|
<p>
|
|
|
|
@i18n!(ctx.1, "To change your avatar, upload it in your gallery and select from there.")
|
|
|
|
<a href="@uri!(medias::new)">@i18n!(ctx.1, "Upload an avatar")</a>
|
|
|
|
</p>
|
2018-12-07 12:05:01 +01:00
|
|
|
<form method="post" action="@uri!(user::update: _name = u.username.clone())">
|
|
|
|
<!-- Rocket hack to use various HTTP methods -->
|
|
|
|
<input type=hidden name="_method" value="put">
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2018-12-07 12:05:01 +01:00
|
|
|
@input!(ctx.1, display_name (text), "Display name", form, errors.clone())
|
|
|
|
@input!(ctx.1, email (text), "Email", form, errors.clone())
|
2019-03-17 20:11:29 +01:00
|
|
|
<label for="summary">@i18n!(ctx.1, "Summary")</label>
|
|
|
|
<textarea id="summary" name="summary">@form.summary</textarea>
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2018-12-07 12:05:01 +01:00
|
|
|
<input type="submit" value="@i18n!(ctx.1, "Update account")"/>
|
2018-12-06 18:54:16 +01:00
|
|
|
</form>
|
2018-12-07 12:05:01 +01:00
|
|
|
|
|
|
|
<h2>@i18n!(ctx.1, "Danger zone")</h2>
|
|
|
|
<p>@i18n!(ctx.1, "Be very careful, any action taken here can't be cancelled.")
|
|
|
|
@if !u.is_admin {
|
|
|
|
<form method="post" action="@uri!(user::delete: name = u.username)">
|
|
|
|
<input type="submit" class="inline-block button destructive" value="@i18n!(ctx.1, "Delete your account")">
|
|
|
|
</form>
|
|
|
|
} else {
|
2018-12-26 13:05:06 +01:00
|
|
|
<p>@i18n!(ctx.1, "Sorry, but as an admin, you can't leave your own instance.")</p>
|
2018-12-07 12:05:01 +01:00
|
|
|
}
|
2018-12-06 18:54:16 +01:00
|
|
|
}
|
|
|
|
})
|