Skip to content

Login Minor Bug #66

Description

@karthik2342323

Login without remember-me option as It will redirect to /home but even if session is assign then also while re-traversing index page It wont redirect to /home so to Fix this
Inside routes.js replace this function with this function which is below

app.get('/', function(req, res){

 // This one is for If session is assign so redirect it 
	if(req.session.user)
	{
		res.redirect('/home');
	}
// check if the user has an auto login key saved in a cookie //
	else if (req.cookies.login == undefined){
		res.render('login', { title: 'Hello - Please Login To Your Account { For Exp} ' });
	}
	else{
// attempt automatic login //
		AM.validateLoginKey(req.cookies.login, req.ip, function(e, o){
			if (o){
				AM.autoLogin(o.user, o.pass, function(o){
					req.session.user = o;
					res.redirect('/home');
				});
			}	else{
				res.render('login', { title: 'Hello - Please Login To Your Account' });
			}
		});
	}
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions