I just started using sails and am trying to implement authentication. I installed everything as advised, and then created a simple login form with jade:
form(action="/auth/local", method="post") div input(name="identifier" type="text") div input(name="password" type="password") div input(type="submit")
This authentication successful log also sends me to the page, returning
{ "createdBy": 1, "owner": 1, "username": "admin", "email": " admin@example.com ", "id": 1, "createdAt": "2015-09-25T18:14:20.000Z", "updatedAt": "2015-09-25T18:39:30.000Z", "gravatarUrl": "https://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61" }
Now I want to redirect the newly registered user to any page, so I tried to change the action of the form to
/auth/local/login
which redirects / login but registers
warn: Error: Invalid action
server side.
In my config / routes file, I have a route like this:
"/login" : { view:"login" }
What is the correct way to set up redirection in sails after logging in?
source share