groupbuddies/theshelf-angular — pull request #3 by azevedo-252 (2014-12-26 00:19:18+00:00)
Title: Auth

I've implemented login and logout features.

Features and notes:
* There'a a main Auth Service which deals with Authorization stuff. I've separated some of its responsibilities into three other services, Session, CurrentUser and AuthHeaders. Other Angular entities should only interact with Auth, and not with the others directly. I'm not sure I should have divided them this way because it may lead people to use them directly, which I would not advise because they are part of something bigger (the Auth service). I can always merge them all back together.
* Session Service:
Sets session data (user id and token) in Local Storage/Cookies;
* CurrentUser Service:
Sets, gets and resets the current user.
* AuthHeaders Services:
Overrides $http default headers
* The session is kept if user refreshes the page.
* The login view is just temporary and made up for this PR to work. It will change eventually, but it has the essential.
* I'm not using ES6 classes for controllers since I've found that Angular's DI system makes classes more cumbersome than typical functions.

One last thing. I'm not a big fan of the current folder/module organization right now. So, right now i'm expecting a pattern in the coming features:

* Components go under ```components/```
* Pages (corresponding to routes/states) don't have a common parent folder, instead i'm putting each in its own folder, under the root.
* Then I have a core module (and its folder) where everything necessary for the project to work and start lives.
* For this authentication stuff, I've created an Auth module, where i've coupled services and configurations related to it.

So I can't say I have a very strict folder structure, nor I am happy with it right now. I guess it's going to change a few times, before I'm satisfied.

This PR is already too big, so i left tests for the next PR.