Skip to content

Commit 0c656bb

Browse files
committed
Change sessions endpoint to use "user"
1 parent 2d27546 commit 0c656bb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

template/$PROJECT_NAME$/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Out of the box this phoenix template contains registration and session JSON endp
5656
- Example POST:
5757
```
5858
{
59-
"session": {
59+
"user": {
6060
"email": "[email protected]",
6161
"password": "secret_password"
6262
}

template/$PROJECT_NAME$/lib/$PROJECT_NAME$_web/controllers/session_controller.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ defmodule <%= @project_name_camel_case %>Web.SessionController do
55

66
action_fallback <%= @project_name_camel_case %>Web.FallbackController
77

8-
plug :scrub_params, "session" when action in [:create]
8+
plug :scrub_params, "user" when action in [:create]
99

10-
def create(conn, %{"session" => session_params}) do
11-
with {:ok, user} <- Session.authenticate(session_params),
10+
def create(conn, %{"user" => user_params}) do
11+
with {:ok, user} <- Session.authenticate(user_params),
1212
{:ok, jwt, _} <- Guardian.encode_and_sign(user, :token) do
1313
conn
1414
|> put_status(:created)

0 commit comments

Comments
 (0)