This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/resources/views/yuuno/auth/activate.twig

68 lines
2.7 KiB
Twig

{% extends 'master.twig' %}
{% set title = 'Request activation' %}
{% block js %}
<script>
function yuunoAttemptActivationResend(form) {
var client = new Sakura.AJAX,
sndBtn = Sakura.DOM.ID('snd-btn');
sndBtn.disabled = true;
sndBtn.innerHTML = '<i class="fa fa-spinner fa-spin"></i>';
Sakura.DOM.AddClass(sndBtn, ['input__button--disabled']);
client.SetUrl("{{ route('auth.activate') }}");
client.SetFormData(new FormData(form));
client.AddCallback(200, function () {
sndBtn.disabled = false;
sndBtn.innerHTML = '<i class="fa fa-envelope"></i> Resend e-mail';
Sakura.DOM.RemoveClass(sndBtn, ['input__button--disabled']);
var result = client.JSON();
if (result.error || result.text) {
var dialogue = new Sakura.Dialogue;
dialogue.Title = "Request activation";
dialogue.Text = result.error || result.text;
dialogue.AddCallback(Sakura.DialogueButton.Ok, function () {
this.Close();
if (result.go) {
window.location.assign(result.go);
}
});
dialogue.Display();
} else if (result.go) {
window.location.assign(result.go);
}
});
client.Start(Sakura.HTTPMethod.POST);
}
</script>
{% endblock %}
{% block content %}
<div class="auth content content--auth">
<div class="content__header">
Request activation
</div>
<form method="post" action="javascript:void(0)" onsubmit="yuunoAttemptActivationResend(this)">
<input type="hidden" name="session" value="{{ session_id() }}">
<label>
<div class="auth__label">Username</div>
<input class="input__text" type="text" name="username" autofocus placeholder="The username you signed up with">
</label>
<label>
<div class="auth__label">E-mail</div>
<input class="input__text" type="text" name="email" placeholder="The e-mail you signed up with">
</label>
<button class="input__button auth__button" id="snd-btn">
<i class="fa fa-envelope"></i> Resend e-mail
</button>
<div class="auth__subtext">
If you lost access to your e-mail account, <a href="{{ route('info.contact') }}">please contact us</a>.
</div>
</form>
</div>
{% endblock %}