From 0614dbf2fb5c8d6a07a70c01bd960223b16a942d Mon Sep 17 00:00:00 2001 From: ChangHyun Lee Date: Tue, 7 Mar 2017 11:14:05 +0900 Subject: [PATCH] [TIC-Web] add log for login - add log for login - remvove console.log Change-Id: I0822b99e5d941362a0a4d3e17a9be63e085342ce Signed-off-by: ChangHyun Lee --- controller/router.js | 7 +++++++ public/src/js/page/package.js | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/controller/router.js b/controller/router.js index 1cdf3a3..36fc8d1 100644 --- a/controller/router.js +++ b/controller/router.js @@ -166,11 +166,13 @@ var init = function (serv) { }, function success(result) { // email validation if (result[0].count !== '0') { + logger.info('invalid password: ' + req.body.password); res.json({ result: 'fail', reason: 'password' }); } else { + logger.info('invalid email:' + req.body.email); res.json({ result: 'fail', reason: 'email' @@ -182,6 +184,8 @@ var init = function (serv) { } else { // save email in session req.session.email = req.body.email; + req.session.group = user.data.user_group; + logger.info('login success: ' + req.body.email + ' , ' + user.data.user_group); res.json({ result: 'success', data: user.data @@ -192,6 +196,7 @@ var init = function (serv) { }); } } else { + logger.info('invalid email:' + req.body.email); res.json({ result: 'fail', reason: 'email' @@ -224,10 +229,12 @@ var init = function (serv) { router.delete('/session', function (req, res) { if (req.session.email) { req.session.destroy(); + logger.info('logout success'); res.json({ result: 'success' }); } else { + logger.info('logout fail'); res.json({ result: 'fail' }); diff --git a/public/src/js/page/package.js b/public/src/js/page/package.js index 76814b4..be1ca24 100644 --- a/public/src/js/page/package.js +++ b/public/src/js/page/package.js @@ -1164,6 +1164,7 @@ define([ }) .then(function (user) { if (user.result === 'success') { + logger.info('login success'); $('#tic-page-login-dropdown-toggle').dropdown('toggle'); // toggle for login and logout $('#tic-navbar-login').toggleClass('hidden', true); // hidden @@ -1171,9 +1172,11 @@ define([ $('#tic-page-logout-dropdown-toggle').html(user.data.user_email +''); } else { if (user.reason === 'email') { + logger.info('invalid email'); $('#tic-page-form-group-email').addClass('has-error has-danger'); $('#tic-page-form-help-email').html('Invalid email.'); } else if (user.reason === 'password') { + logger.info('invalid password'); $('#tic-page-form-group-password').addClass('has-error has-danger'); $('#tic-page-form-help-password').html('Invalid password.'); } @@ -1188,8 +1191,8 @@ define([ Util.DELETE('api/session') .then(function (result) { - console.log(result); if (result.result === 'success') { + logger.info('logout success'); $('#tic-page-logout-dropdown-toggle').dropdown('toggle'); // toggle for logout and login $('#tic-navbar-login').toggleClass('hidden', false); // visible -- 2.7.4