manukall / phoenix_token_auth

Token authentication solution for Phoenix. Useful for APIs for e.g. single page apps.
MIT License
163 stars 39 forks source link

Some routes changes #32

Closed OpakAlex closed 9 years ago

OpakAlex commented 9 years ago
 defmacro mount do
    quote do
      post  "users",                 PhoenixTokenAuth.Controllers.Users, :create
      post  "users/:id/confirm",     PhoenixTokenAuth.Controllers.Users, :confirm
      post  "sessions",              PhoenixTokenAuth.Controllers.Sessions, :create
      delete  "sessions",            PhoenixTokenAuth.Controllers.Sessions, :delete
      post  "password_resets",       PhoenixTokenAuth.Controllers.PasswordResets, :create
      post  "password_resets/reset", PhoenixTokenAuth.Controllers.PasswordResets, :reset
      get   "account",               PhoenixTokenAuth.Controllers.Account, :show
      put   "account",               PhoenixTokenAuth.Controllers.Account, :update
    end
  end

I thinks, we need change some url, for example: post "sessions" it must be post "users/sign_in" delete "sessions" it must be 'delete' "users/sign_out"

What are you think?

OpakAlex commented 9 years ago

@manukall :)

manukall commented 9 years ago

hey @OpakAlex i don't see the reason to change it. what's the use case or problem you're running into?

alexjp commented 9 years ago

I may add that i dont like very much that there are

      post  "users",                 PhoenixTokenAuth.Controllers.Users, :create
      post  "users/:id/confirm",     PhoenixTokenAuth.Controllers.Users, :confirm

This takes for granted that the "user" model is called users.

I successfully managed to make it use the "Account" model ( taken idea from your use of account model )

OpakAlex commented 9 years ago

@alexjp Account model it's not user. In real projects you have User and Account. I think we need do get request to users, not to accounts.

manukall commented 9 years ago

it's pretty easy to just define your own routes. just instead of putting PhoenixTokenAuth.mount into your router define them manually as that macro would.

alexjp commented 9 years ago

@manukall definitly. Later at night, can i do a pull request to the documentation ? "Customizing routes?"

manukall commented 9 years ago

@alexjp that would be extremely great :smiley:

OpakAlex commented 9 years ago

+1