Interview Question


Country: India




Comment hidden because of low score. Click to expand.
2
of 2 vote

Set browser cookie, when user successfully logged in.
Read the cookie, while opening the application. If there is no cookie, ask for log in. Other wise, he is already logged in and hence enabled = true.
Set the cookie expire as browser close. Hence, when a browser is closed, browser will automatically delete the cookie. Hence, user is no more logged in.

- satyacbit November 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

but it allows logging in two browsers!! one account can be logged in one time at the same time!

- cobra November 25, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes indeed and most common behavior in web context. Check any most popular log-in pages, Facebook, Gmaill, Careecup ... etc. Different browsers will not have a common space to maintain these information. Except storing it at server side with IP. But is is very costly in tems of performance.

- satyacbit November 26, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

but what is case when cookies are disabled

- arun November 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I can think of having a refresh timeout(when the live session will fetch latest data) and a session timeout(user being idle for some time). Using that even when the user close the browser, if the last refresh time - login time is greater than any defined idle time say 2 minutes than the value of 'ENABLED' should get updated back to false. A DB trigger can handle that request.

Please share in case you got any other way to handle your request.

- rohitatiit November 24, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More