This is an attempt to extract away some of the boilerplate from the users controller. There's still a bit of manual password validation which I dislike, but apparently its tough to work with virtual attributes within MongoMapper so validates_confirmation_of :password is out as far as I can tell.
Additionally, I fixed some issues with session management - sessions/create.html.erb should not be a view (only a processing action) and so it's been removed. Finally, I added the missing else clause to catch invalid credentials.
Added helper routes are '/login' => 'sessions#new' as login_path and 'logout' => 'sessions#destroy' as logout_path
This is an attempt to extract away some of the boilerplate from the users controller. There's still a bit of manual password validation which I dislike, but apparently its tough to work with virtual attributes within MongoMapper so
validates_confirmation_of :password
is out as far as I can tell.Additionally, I fixed some issues with session management -
sessions/create.html.erb
should not be a view (only a processing action) and so it's been removed. Finally, I added the missing else clause to catch invalid credentials.Added helper routes are
'/login' => 'sessions#new'
aslogin_path
and'logout' => 'sessions#destroy'
aslogout_path