     authenticatedAction: (req, res) =>
         res.send success: req.isAuthenticated()
 
-    # Check user credentials and keep user authentication through session.
-    loginAction: (req, res) =>
+    authenticate: (req, res) =>
+        # Check user credentials and keep user authentication through session.
         answer = (err) =>
             if err
                 @sendError res, "Login failed"
             else
-                @sendSuccess res, "Login succeeds"
+                @sendSuccess res, "Login succeeded"
 
         authenticator = passport.authenticate 'local', (err, user) =>
             if err

        
        res.send
            success: true
            msg: "Log out succeeds."

    # Create user with given credentials
    registerAction: (req, res) =>

                    console.log err
                    @sendError res, "Server error occured.", 500
                else
                    req.body.username = "owner"
                    @authenticate req, res

        user =
            email: email
