Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds cookie based login, also called "remember me"-functionality.
This commit fixes issue #284 by adding cookies/authentication tokens at the client side and validating these in the DB. When a user either registers or logs in, without already having a cookie, a sha1-hash is generated using the username and a secret key. This hash is stored in a DB-table calles 'Session' and client side using the jquery-cookie plugin. When closing and opening the application again we check if the users have a 'auth_token' in their cookies, if this is the case we check its validity in the DB. If everything is OK, we 'jump through the hoops' and sets the user as logged in, restores his/hers connections and render the chat_application. If it is not valid we delete the cookie at the client and render the overview page. As I've never actually implemented a cookie-based login system using javascript before, I do not know if this solution is optimal and I'm more than happy to discuss alternative approaches or restructure the code.
- Loading branch information
Showing
7 changed files
with
136 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters