diff --git a/nodejs/public/lib/js/app-base.js b/nodejs/public/lib/js/app-base.js index 293842d..8b785aa 100644 --- a/nodejs/public/lib/js/app-base.js +++ b/nodejs/public/lib/js/app-base.js @@ -313,7 +313,7 @@ app.util = (function(app){ function downloadFile(filename, text){ // https://stackoverflow.com/a/18197341 - + var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); @@ -354,7 +354,7 @@ $( document ).ready(function(){ }); setInterval(()=>{ - $('.momentFromNow').each((idx,el)=>{ + $('.momentFromNow').each((idx, el)=>{ var $el = $(el); try{ $el.html(moment($(el).data('date')).fromNow()); @@ -364,9 +364,9 @@ $( document ).ready(function(){ }); //ajax form submit -function formAJAX(btn, del){ - event.preventDefault(); // avoid to execute the actual submit of the form. - var $form = $(btn).closest('[action]'); // gets the 'form' parent +function formAJAX(btn){ + event.preventDefault(btn); // avoid to execute the actual submit of the form. + var $form = $(btn || event.target).closest('[action]'); // gets the 'form' parent var formData = $form.find('[name]').serializeObject(); // builds query formDataing var method = ($form.attr('method') || 'post').toLowerCase(); diff --git a/nodejs/routes/render.js b/nodejs/routes/render.js index 1a8a0f7..f2995e5 100644 --- a/nodejs/routes/render.js +++ b/nodejs/routes/render.js @@ -36,7 +36,7 @@ router.get('/users', async function(req, res, next) { res.render('users', {...values}); }); -router.get('/login', async function(req, res, next) { +router.get('/login*', async function(req, res, next) { res.render('login', {...values, redirect: req.query.redirect}); }); diff --git a/nodejs/views/login.ejs b/nodejs/views/login.ejs index 524d6d4..858427a 100755 --- a/nodejs/views/login.ejs +++ b/nodejs/views/login.ejs @@ -12,9 +12,24 @@