This commit is contained in:
flash 2016-09-22 22:14:28 +02:00
parent fc34d4d4c3
commit 64100805fd
7 changed files with 48 additions and 67 deletions

View file

@ -70,10 +70,6 @@ class AdvancedController extends Controller
*/
public function deactivate()
{
if (CurrentSession::$user->permission(Site::DEACTIVATED)) {
return view('settings/advanced/deactivate_bye');
}
if (!CurrentSession::$user->permission(Site::DEACTIVATE_ACCOUNT)) {
throw new HttpMethodNotAllowedException();
}

View file

@ -6,25 +6,6 @@
<p>Alter the details of your account, leave fields blank to leave them unchanged.</p>
{% endblock %}
{% block js %}
{{ parent() }}
<script>
function updateSettingsConfirm(form, action) {
var dialogue = new Sakura.Dialogue;
dialogue.Text = "Are you sure?";
dialogue.SetType(Sakura.DialogueType.Confirm);
dialogue.AddCallback(Sakura.DialogueButton.No, function () {
this.Close();
});
dialogue.AddCallback(Sakura.DialogueButton.Yes, function () {
updateSettings(form, action);
this.Close();
});
dialogue.Display();
}
</script>
{% endblock %}
{% block settingsContent %}
<form enctype="multipart/form-data" method="post" action="javascript:;" onsubmit="updateSettingsConfirm(this, '{{ route('settings.account.details') }}');">
{% if edit_email %}

View file

@ -1,33 +1,3 @@
{% extends 'settings/master.twig' %}
{% set category = 'Account' %}
{% block js %}
<script>
function updateSettings(form, action) {
var forms = {},
dialogue = new Sakura.Dialogue,
updater = new Sakura.AJAX;
dialogue.AddCallback(Sakura.DialogueButton.Ok, function () {
this.Close();
});
for (var a = 0; a < form.elements.length; a++) {
forms[form.elements.item(a).name] = form.elements.item(a).value;
}
updater.SetUrl(action);
updater.Form();
updater.SetSend(forms);
updater.AddCallback(0, function () {
var resp = updater.JSON();
dialogue.Text = resp.error || 'Updated!';
dialogue.Display();
});
updater.Start(Sakura.HTTPMethod.POST);
return false;
}
</script>
{% endblock %}

View file

@ -3,9 +3,10 @@
{% set mode = 'Deactivate' %}
{% block description %}
<p>You can deactivate your account here if you want to leave :(.</p>
<p>This will remove your account from every rank it's a part of and make you unable to login.</p>
<p>You can deactivate your account here if you want to leave.</p>
<p>This will remove your account from every rank it's a part of.</p>
<p>If you have an active Tenshi tag on your account it won't pause while your account is deactivated.</p>
<p>You can reactivate your account by logging in within 30 days, after that period your account will be removed.</p>
{% endblock %}
{% block settingsContent %}

View file

@ -1,11 +0,0 @@
{% extends 'master.twig' %}
{% set title = 'Farewell!' %}
{% block content %}
<div class="content standalone" style="text-align: center;">
<h1 class="stylised" style="margin: 1em auto;">Farewell!</h1>
<h1 class="fa fa-frown-o stylised" style="font-size: 20em;"></h1>
<h3>Remember that you can reactivate your account anytime if you decide to come back!</h3>
</div>
{% endblock %}

View file

@ -2,6 +2,50 @@
{% set title = category ~ ' / ' ~ mode %}
{% block js %}
<script>
function updateSettings(form, action, text) {
var forms = {},
dialogue = new Sakura.Dialogue,
updater = new Sakura.AJAX;
dialogue.AddCallback(Sakura.DialogueButton.Ok, function () {
this.Close();
});
for (var a = 0; a < form.elements.length; a++) {
forms[form.elements.item(a).name] = form.elements.item(a).value;
}
updater.SetUrl(action);
updater.Form();
updater.SetSend(forms);
updater.AddCallback(0, function () {
var resp = updater.JSON();
dialogue.Text = resp.error || text || 'Updated!';
dialogue.Display();
});
updater.Start(Sakura.HTTPMethod.POST);
return false;
}
function updateSettingsConfirm(form, action) {
var dialogue = new Sakura.Dialogue;
dialogue.Text = "Are you sure?";
dialogue.SetType(Sakura.DialogueType.Confirm);
dialogue.AddCallback(Sakura.DialogueButton.No, function () {
this.Close();
});
dialogue.AddCallback(Sakura.DialogueButton.Yes, function () {
updateSettings(form, action);
this.Close();
});
dialogue.Display();
}
</script>
{% endblock %}
{% block content %}
<div class="content settings messages {% if showBG %}background-transparent{% endif %}">
<div class="content-right content-column">

View file

@ -78,7 +78,7 @@
window.addEventListener('load', function () {
{% if profile.lastfm %}
var np = new Sakura.AJAX();
np.SetUrl("{{ route('user.nowplaying', user.id) }}");
np.SetUrl("{{ route('user.nowplaying', profile.id) }}");
np.AddCallback(200, function () {
var data = np.JSON(),
artist = Sakura.DOM.ID('np-artist'),