mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Make session language consistent
This commit is contained in:
parent
1299d4f5e5
commit
ddcb204758
@ -18,7 +18,7 @@ defmodule ChessWeb.SessionController do
|
||||
{:ok, user} ->
|
||||
conn
|
||||
|> Guardian.Plug.sign_in(user)
|
||||
|> put_flash(:info, "You are signed in")
|
||||
|> put_flash(:info, "You are logged in")
|
||||
|> redirect(to: game_path(conn, :index))
|
||||
{:error, _error} ->
|
||||
changeset = User.changeset(%User{})
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<h2>Sign in</h2>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<%= form_for @changeset, session_path(@conn, :create), [class: "create-session"], fn f -> %>
|
||||
<%= if @changeset.action do %>
|
||||
@ -16,6 +16,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= submit "Sign in", class: "btn btn-primary" %>
|
||||
<%= submit "Log in", class: "btn btn-primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
defmodule Chess.SessionControllerTest do
|
||||
use ChessWeb.ConnCase
|
||||
|
||||
test "shows sign in form", %{conn: conn} do
|
||||
test "shows log in form", %{conn: conn} do
|
||||
conn = get conn, session_path(conn, :new)
|
||||
assert html_response(conn, 200) =~ "Sign in"
|
||||
assert html_response(conn, 200) =~ "Log in"
|
||||
end
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ defmodule Chess.GamesTest do
|
||||
|> visit("/session/new")
|
||||
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Sign in"))
|
||||
|> click(button("Log in"))
|
||||
end
|
||||
|
||||
defp create_user() do
|
||||
|
||||
@ -5,7 +5,7 @@ defmodule Chess.SessionTest do
|
||||
|
||||
import Wallaby.Query, only: [text_field: 1, link: 1, button: 1]
|
||||
|
||||
test "user cannot sign in with incorrect username", %{session: session} do
|
||||
test "user cannot log in with incorrect username", %{session: session} do
|
||||
create_user()
|
||||
|
||||
session
|
||||
@ -13,12 +13,12 @@ defmodule Chess.SessionTest do
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@example.com")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Sign in"))
|
||||
|> click(button("Log in"))
|
||||
|
||||
assert session |> has_text?("Bad username or password")
|
||||
end
|
||||
|
||||
test "user cannot sign in with incorrect password", %{session: session} do
|
||||
test "user cannot log in with incorrect password", %{session: session} do
|
||||
create_user()
|
||||
|
||||
session
|
||||
@ -26,12 +26,12 @@ defmodule Chess.SessionTest do
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|
||||
|> fill_in(text_field("Password"), with: "calamityganon")
|
||||
|> click(button("Sign in"))
|
||||
|> click(button("Log in"))
|
||||
|
||||
assert session |> has_text?("Bad username or password")
|
||||
end
|
||||
|
||||
test "user can sign in with correct details", %{session: session} do
|
||||
test "user can log in with correct details", %{session: session} do
|
||||
create_user()
|
||||
|
||||
session
|
||||
@ -39,14 +39,14 @@ defmodule Chess.SessionTest do
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Sign in"))
|
||||
|> click(button("Log in"))
|
||||
|
||||
assert session |> has_text?("You are signed in")
|
||||
assert session |> has_text?("You are logged in")
|
||||
assert session |> has_text?("Listing games")
|
||||
assert session |> has_text?("link@hyrule.kingdom")
|
||||
end
|
||||
|
||||
test "user can sign out", %{session: session} do
|
||||
test "user can log out", %{session: session} do
|
||||
create_user()
|
||||
|
||||
session
|
||||
@ -54,7 +54,7 @@ defmodule Chess.SessionTest do
|
||||
|> click(link("Log in"))
|
||||
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|
||||
|> fill_in(text_field("Password"), with: "ilovezelda")
|
||||
|> click(button("Sign in"))
|
||||
|> click(button("Log in"))
|
||||
|
||||
session
|
||||
|> visit("/")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user