* Delete mods/login.js (not used)
* More fallbackMenuModule & gotoMenuModule clean up -- should all be using new system now
This commit is contained in:
parent
f7a7423b32
commit
b1be5cdff4
|
@ -448,15 +448,6 @@ Client.prototype.address = function() {
|
|||
return this.input.address();
|
||||
};
|
||||
|
||||
// :TODO: remove these deprecated wrappers:
|
||||
Client.prototype.gotoMenuModule = function(options, cb) {
|
||||
this.menuStack.goto(options.name, options, cb);
|
||||
};
|
||||
|
||||
Client.prototype.fallbackMenuModule = function(options, cb) {
|
||||
this.menuStack.prev(cb);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Default error handlers
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -834,9 +834,7 @@ function FullScreenEditorModule(options) {
|
|||
replyDiscard : function(formData, extraArgs) {
|
||||
// :TODO: need to prompt yes/no
|
||||
// :TODO: @method for fallback would be better
|
||||
self.client.fallbackMenuModule(function fallback(err) {
|
||||
console.log(err)
|
||||
});
|
||||
self.prevMenu();
|
||||
},
|
||||
*/
|
||||
editModeMenuHelp : function(formData, extraArgs) {
|
||||
|
|
|
@ -7,24 +7,6 @@ var loadMenu = require('./menu_util.js').loadMenu;
|
|||
var _ = require('lodash');
|
||||
var assert = require('assert');
|
||||
|
||||
/*
|
||||
MenuStack(client)
|
||||
stack[] push, pop, ...
|
||||
|
||||
next()
|
||||
goto(name, options, cb)
|
||||
prev()
|
||||
|
||||
MenuModule
|
||||
nextMenu()
|
||||
gotoMenu(name, options, cb)
|
||||
prevMenu()
|
||||
*/
|
||||
|
||||
// :TODO: Clean up client attach/detach/etc.
|
||||
// :TODO: gotoMenuModule() -> MenuModule.gotoMenu()
|
||||
// :TODO: fallbackMenuModule() -> MenuModule.prevMenu()
|
||||
|
||||
module.exports = MenuStack;
|
||||
|
||||
function MenuStack(client) {
|
||||
|
|
|
@ -37,14 +37,14 @@ function login(callingMenu, formData, extraArgs) {
|
|||
}
|
||||
|
||||
setTimeout(function timeout() {
|
||||
client.fallbackMenuModule();
|
||||
callingMenu.prevMenu();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
return;
|
||||
} else {
|
||||
// Other error
|
||||
client.fallbackMenuModule();
|
||||
callingMenu.prevMenu();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -45,7 +45,7 @@ function UserConfigModule(options) {
|
|||
this.menuMethods = {
|
||||
exitKeyPressed : function(formData, extraArgs) {
|
||||
// :TODO: save/etc.
|
||||
self.client.fallbackMenuModule();
|
||||
self.prevMenu();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ function AbracadabraModule(options) {
|
|||
function complete(err) {
|
||||
if(err) {
|
||||
self.lastError = err;
|
||||
self.client.fallbackMenuModule();
|
||||
self.prevMenu();
|
||||
} else {
|
||||
self.finishedLoading();
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ function AbracadabraModule(options) {
|
|||
var doorInstance = new door.Door(this.client, exeInfo);
|
||||
|
||||
doorInstance.on('finished', function doorFinished() {
|
||||
self.client.fallbackMenuModule();
|
||||
self.prevMenu();
|
||||
});
|
||||
|
||||
self.client.term.write(ansi.resetScreen());
|
||||
|
|
|
@ -124,18 +124,21 @@ function submitApplication(callingMenu, formData, extraArgs) {
|
|||
if(err) {
|
||||
Log.info( { error : err, username : formData.value.username }, 'New user creation failed');
|
||||
|
||||
client.gotoMenuModule( { name : extraArgs.error } );
|
||||
callingMenu.gotoMenu(extraArgs.error, function result(err) {
|
||||
if(err) {
|
||||
callingMenu.prevMenu();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
||||
|
||||
if(user.User.AccountStatus.inactive === client.user.properties.account_status) {
|
||||
client.gotoMenuModule( { name : extraArgs.inactive } );
|
||||
callingMenu.gotoMenu(extraArgs.inactive);
|
||||
} else {
|
||||
//
|
||||
// If active now, we need to call login() to authenticate
|
||||
//
|
||||
sysMenuMethod.login(callingMenu, formData, extraArgs);
|
||||
// client.gotoMenuModule( { name : menuConfig.next } );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
var theme = require('../core/theme.js');
|
||||
var Log = require('../core/logger.js').log;
|
||||
|
||||
var async = require('async');
|
||||
|
||||
exports.login = login;
|
||||
|
||||
function login(callingMenu, formData, extraArgs) {
|
||||
var client = callingMenu.client;
|
||||
|
||||
client.user.authenticate(formData.value.username, formData.value.password, function authenticated(err) {
|
||||
if(err) {
|
||||
Log.info( { username : formData.value.username }, 'Failed login attempt %s', err);
|
||||
|
||||
client.gotoMenuModule( { name : callingMenu.menuConfig.fallback } );
|
||||
} else {
|
||||
// use client.user so we can get correct case
|
||||
Log.info( { username : callingMenu.client.user.username }, 'Successful login');
|
||||
|
||||
async.parallel(
|
||||
[
|
||||
function loadThemeConfig(callback) {
|
||||
theme.getThemeInfo(client.user.properties.theme_id, function themeInfo(err, info) {
|
||||
client.currentTheme = info;
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
],
|
||||
function complete(err, results) {
|
||||
client.gotoMenuModule( { name : callingMenu.menuConfig.next } );
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -55,10 +55,10 @@ function MessageAreaListModule(options) {
|
|||
self.client.term.pipeWrite('\n|00Cannot change area: ' + err.message + '\n');
|
||||
|
||||
setTimeout(function timeout() {
|
||||
self.client.fallbackMenuModule();
|
||||
self.prevMenu();
|
||||
}, 1000);
|
||||
} else {
|
||||
self.client.fallbackMenuModule();
|
||||
self.prevMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -48,10 +48,7 @@ function AreaPostFSEModule(options) {
|
|||
console.log(msg);
|
||||
}
|
||||
|
||||
self.client.fallbackMenuModule( { }, function result(err) {
|
||||
// :TODO: how to best handle this??? fallbackMenuModule should prob inspect options & cb to be optional. gotoMenuModule() already has default cb
|
||||
});
|
||||
//self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
|
||||
self.prevMenu();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
@ -71,14 +71,13 @@ function AreaViewFSEModule(options) {
|
|||
this.menuMethods.replyMessage = function(formData, extraArgs) {
|
||||
if(_.isString(extraArgs.menu)) {
|
||||
var modOpts = {
|
||||
name : extraArgs.menu,
|
||||
extraArgs : {
|
||||
messageAreaName : self.messageAreaName,
|
||||
replyToMessage : self.message,
|
||||
}
|
||||
};
|
||||
|
||||
self.client.gotoMenuModule(modOpts);
|
||||
self.gotoMenu(extraArgs.menu, modOpts);
|
||||
} else {
|
||||
self.client.log(extraArgs, 'Missing extraArgs.menu');
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ function MessageListModule(options) {
|
|||
selectMessage : function(formData, extraArgs) {
|
||||
if(1 === formData.submitId) {
|
||||
var modOpts = {
|
||||
name : config.menuViewPost || 'messageAreaViewPost',//'messageAreaViewPost', // :TODO: should come from config!!!
|
||||
extraArgs : {
|
||||
messageAreaName : self.messageAreaName,
|
||||
messageList : self.messageList,
|
||||
|
|
Loading…
Reference in New Issue