                 else
                     createUser()
         else
-            @sendError res, @userManager.error
+            @sendError res, @userManager.error, 400
 
     # Send an email with a temporary key that allows acceess to
     # a change password page.
     forgotPasswordAction: (req, res) =>
 
-        sendEmail = (instances) =>
+        sendEmail = (instances, user, key) =>
             if instances.length > 0
                 instance = instances[0].value
             else

                        console.log err
                        @sendError res, "Server error occured.", 500
                    else
                        sendEmail instances

    # Display reset password view, only if given key is valid.
    resetPasswordView: (req, res) =>

                    req.logIn user, {}, =>
                        @sendSuccess res, "Register succeeds."

        user =
            email: email
            password: password
            
        if @userManager.isValid user
            @userManager.all (err, users) =>
                if err
