Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login Minor Bug #66

Open
karthik2342323 opened this issue Apr 7, 2021 · 0 comments
Open

Login Minor Bug #66

karthik2342323 opened this issue Apr 7, 2021 · 0 comments

Comments

@karthik2342323
Copy link

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' });
			}
		});
	}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant