Настройка редиректов на стр. обновления профиля, инфо-сообщение при смене пароля

parent 52152268
$(document).ready(function(){ $(document).ready(function(){
$('.wrapp-button').on('click', function(){ $('.wrapp-button').on('click', function(){
var $this = $(this);
//var form = $(this).parent().parent()[0].querySelector('form'); var
var form = $(this).parent('form')[0]; $this = $(this),
var formData = new FormData(form); form = $(this).parent('form')[0],
var redirect; formData = new FormData(form),
redirectUrl = $(form).attr("data-url-success");
if ($this.eq(0).hasClass("reset")) { if ($this.eq(0).hasClass("reset")) {
var redirectUrl = $this.eq(0).data("url"); document.location.href = redirectUrl;
redirect = function () {
document.location.href = redirectUrl;
};
setTimeout(
function () {
$("main").animate({
opacity: 0
}, 500);
setTimeout(redirect, 500);
},
1000
);
} else { } else {
$.ajax({ $.ajax({
url: $(form).attr("data-url"), url: $(form).attr("data-url"),
...@@ -34,13 +22,14 @@ $(document).ready(function(){ ...@@ -34,13 +22,14 @@ $(document).ready(function(){
success: function(data) { success: function(data) {
if (data.result) { if (data.result) {
console.log(data); console.log(data);
$.showMessage('info', $this.data('action')); $.showMessage('info', $this.data('action'));
setTimeout(function(){ setTimeout(function(){
document.location.reload(); //document.location.reload();
document.location.href = redirectUrl;
}, 1000); }, 1000);
} else { } else {
console.log(data); console.log(data);
$.showMessage('error', data.msg.text);
} }
}, },
error: function (e) { error: function (e) {
......
...@@ -58,7 +58,7 @@ $lang = $layoutInfo ? $layoutInfo->getLang() : 'en'; ...@@ -58,7 +58,7 @@ $lang = $layoutInfo ? $layoutInfo->getLang() : 'en';
<body> <body>
<?php <?php
//$urlHome = $this->url(in_array($identityRole, [\App\Acl\Roles::ROLE_ADMIN,\App\Acl\Roles::ROLE_MANAGER]) ?'adm.index' :'home',['lang' => $lang]); //$urlHome = $this->url(in_array($identityRole, [\App\Acl\Roles::ROLE_ADMIN,\App\Acl\Roles::ROLE_MANAGER]) ?'adm.index' :'home',['lang' => $lang]);
//$urlHome = $this->url('user.cabinet',['lang' => $lang]); $urlHome = $this->url('user.cabinet',['lang' => $lang]);
?> ?>
...@@ -96,7 +96,7 @@ $lang = $layoutInfo ? $layoutInfo->getLang() : 'en'; ...@@ -96,7 +96,7 @@ $lang = $layoutInfo ? $layoutInfo->getLang() : 'en';
//$urlCabinet = $this->url('user.cabinet',['lang' => $lang]); //$urlCabinet = $this->url('user.cabinet',['lang' => $lang]);
$urlCabinet = $this->url('user.cabinet.profile',['lang' => $lang]); $urlCabinet = $this->url('user.cabinet.profile',['lang' => $lang]);
?> ?>
<a href="<?= $urlCabinet ?>" class="annotation" title="<?= _t("Мой кабинет") ?>"><?= $identity->getEmail() ?></a> <a href="<?= $urlCabinet ?>" class="annotation" title="<?= _t("Настройки профиля") ?>"><?= $identity->getEmail() ?></a>
</div> </div>
<div class="header-logout col sm-2 order-xs-1"> <div class="header-logout col sm-2 order-xs-1">
<a href="<?= $this->url('logout', ['lang' => $lang]) ?>" title="<?= _t("Выход") ?>" class="annotation"><?= _t("Выход") ?></a> <a href="<?= $this->url('logout', ['lang' => $lang]) ?>" title="<?= _t("Выход") ?>" class="annotation"><?= _t("Выход") ?></a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment