Updated validPassword function
Fixed registration redirects
Fixed login redirects
Added tests for user model