Added support for re-auth on submit to rank manager when session goes bad; still more to come
--- a/includes/clientside/static/login.js Mon Dec 22 21:26:19 2008 -0500
+++ b/includes/clientside/static/login.js Mon Dec 22 21:54:30 2008 -0500
@@ -1169,14 +1169,24 @@
var replace = new RegExp(old_sid, 'g');
body.innerHTML = body.innerHTML.replace(replace, k);
ENANO_SID = k;
- if ( targetpage )
+ mb_current_obj.destroy();
+ console.debug(targetpage);
+ if ( typeof(targetpage) == 'string' )
{
- mb_current_obj.destroy();
ajaxPage(targetpage);
}
+ else if ( typeof(targetpage) == 'function' )
+ {
+ targetpage();
+ }
}, USER_LEVEL_ADMIN);
ajaxLoginShowFriendlyError({
error_code: 'admin_session_timed_out',
respawn_info: {}
});
}
+
+window.ajaxRenewSession = function()
+{
+ ajaxDynamicReauth(false);
+}
--- a/includes/clientside/static/rank-manager.js Mon Dec 22 21:26:19 2008 -0500
+++ b/includes/clientside/static/rank-manager.js Mon Dec 22 21:54:30 2008 -0500
@@ -507,6 +507,23 @@
{
handle_invalid_json(ajax.responseText);
}
+ if ( response.error )
+ {
+ if ( response.error == 'need_auth_to_admin' )
+ {
+ load_component('login');
+ var rid = rank_id;
+ ajaxDynamicReauth(function()
+ {
+ ajaxInitRankEdit(rid);
+ });
+ }
+ else
+ {
+ alert(response.error);
+ }
+ return false;
+ }
var editor = new RankEditorControl(response);
editor.onsubmit = ajaxRankEditHandleSaveExisting;
editor.ondelete = ajaxRankEditHandleDelete;
@@ -609,23 +626,34 @@
else
{
whitey.parentNode.removeChild(whitey);
- miniPromptMessage({
- title: $lang.get('acpur_err_save_failed_title'),
- message: response.error,
- buttons: [
- {
- text: $lang.get('etc_ok'),
- color: 'red',
- style: {
- fontWeight: 'bold'
- },
- onclick: function()
+ if ( response.error == 'need_auth_to_admin' )
+ {
+ load_component('login');
+ ajaxDynamicReauth(function()
+ {
+ ajaxRankEditHandleSave(editor, switch_new);
+ });
+ }
+ else
+ {
+ miniPromptMessage({
+ title: $lang.get('acpur_err_save_failed_title'),
+ message: response.error,
+ buttons: [
{
- miniPromptDestroy(this);
+ text: $lang.get('etc_ok'),
+ color: 'red',
+ style: {
+ fontWeight: 'bold'
+ },
+ onclick: function()
+ {
+ miniPromptDestroy(this);
+ }
}
- }
- ]
- });
+ ]
+ });
+ }
}
}
}, true);
@@ -733,23 +761,34 @@
else
{
whitey.parentNode.removeChild(whitey);
- miniPromptMessage({
- title: $lang.get('acpur_err_delete_failed_title'),
- message: response.error,
- buttons: [
- {
- text: $lang.get('etc_ok'),
- color: 'red',
- style: {
- fontWeight: 'bold'
- },
- onclick: function()
+ if ( response.error == 'need_auth_to_admin' )
+ {
+ load_component('login');
+ ajaxDynamicReauth(function()
+ {
+ ajaxRankEditDeleteConfirmed(editor);
+ });
+ }
+ else
+ {
+ miniPromptMessage({
+ title: $lang.get('acpur_err_delete_failed_title'),
+ message: response.error,
+ buttons: [
{
- miniPromptDestroy(this);
+ text: $lang.get('etc_ok'),
+ color: 'red',
+ style: {
+ fontWeight: 'bold'
+ },
+ onclick: function()
+ {
+ miniPromptDestroy(this);
+ }
}
- }
- ]
- });
+ ]
+ });
+ }
}
}
}, true);