Commit 7ef4559b authored by Mikko Ahlroth's avatar Mikko Ahlroth

Bump Phoenix version to 1.4

parent 4fe97b0e
Pipeline #39447214 failed with stage
in 6 minutes and 20 seconds
......@@ -11,7 +11,6 @@ config :logger, level: :warn
# Configure your database
config :code_stats, CodeStats.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "code_stats_ci",
......
......@@ -87,8 +87,6 @@ config :phoenix, :template_engines,
eex: Appsignal.Phoenix.Template.EExEngine,
exs: Appsignal.Phoenix.Template.ExsEngine
config :code_stats, CodeStats.Repo, loggers: [Appsignal.Ecto, Ecto.LogEntry]
config :appsignal, :config,
filter_parameters: [
"password",
......@@ -115,6 +113,9 @@ config :mbu,
import_config "appsignal.exs"
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
......@@ -35,7 +35,7 @@ config :phoenix, :stacktrace_depth, 20
# Configure your database
config :code_stats, CodeStats.Repo,
adapter: Ecto.Adapters.Postgres,
log: :debug,
username: "postgres",
password: "postgres",
database: "code_stats_dev",
......
......@@ -11,7 +11,6 @@ config :logger, level: :warn
# Configure your database
config :code_stats, CodeStats.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "code_stats_test",
......
defmodule CodeStats.Repo do
use Ecto.Repo, otp_app: :code_stats
use Ecto.Repo, otp_app: :code_stats, adapter: Ecto.Adapters.Postgres
end
......@@ -45,7 +45,7 @@ defmodule CodeStats.User do
|> validate_length(:password, min: 1, max: 255)
|> validate_format(:username, ~r/^[^\/#%?&=+]+$/)
|> validate_latest_terms()
|> validations()
|> common_validations()
|> unique_constraint(:username)
|> unique_constraint(:lower_username)
end
......@@ -56,7 +56,7 @@ defmodule CodeStats.User do
def updating_changeset(data, params \\ %{}) do
data
|> cast(params, [:email, :private_profile])
|> validations()
|> common_validations()
end
@doc """
......@@ -317,7 +317,7 @@ defmodule CodeStats.User do
end
# Common validations for creating and editing users
defp validations(changeset) do
defp common_validations(changeset) do
changeset
|> validate_format(:email, ~r/^$|@/)
end
......
......@@ -24,7 +24,7 @@ defmodule CodeStatsWeb do
import Ecto
import Ecto.Query, only: [from: 1, from: 2]
import CodeStatsWeb.Router.Helpers
alias CodeStatsWeb.Router.Helpers, as: Routes
import CodeStatsWeb.Gettext
end
end
......@@ -47,7 +47,7 @@ defmodule CodeStatsWeb do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
import CodeStatsWeb.Router.Helpers
alias CodeStatsWeb.Router.Helpers, as: Routes
import CodeStatsWeb.ErrorHelpers
import CodeStatsWeb.Gettext
end
......
......@@ -11,10 +11,6 @@ defmodule CodeStatsWeb.LiveUpdateSocket do
channel("users:*", CodeStatsWeb.ProfileChannel)
channel("frontpage", CodeStatsWeb.FrontpageChannel)
## Transports
transport(:websocket, Phoenix.Transports.WebSocket)
# transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed from the client and can
# be used to verify and authenticate a user. After
# verification, you can put default assigns into
......
......@@ -28,7 +28,7 @@ defmodule CodeStatsWeb.AuthController do
with %User{} = user <- User.get_by_username(username, true),
%Plug.Conn{} = conn <- AuthUtils.auth_user(conn, user, password),
%Plug.Conn{} = conn <- maybe_remember_me(conn, user, params) do
redirect(conn, to: profile_path(conn, :my_profile))
redirect(conn, to: Routes.profile_path(conn, :my_profile))
else
ret ->
# If ret is nil, user was not found -> run dummy auth to prevent user enumeration
......@@ -68,7 +68,7 @@ defmodule CodeStatsWeb.AuthController do
:success,
"Great success! Your account was created and you can now log in with the details you provided."
)
|> redirect(to: auth_path(conn, :render_login))
|> redirect(to: Routes.auth_path(conn, :render_login))
end
end
......@@ -76,7 +76,7 @@ defmodule CodeStatsWeb.AuthController do
conn
|> AuthUtils.unauth_user()
|> RememberMePlug.kill_cookie()
|> redirect(to: page_path(conn, :index))
|> redirect(to: Routes.page_path(conn, :index))
end
def render_forgot(conn, _params) do
......@@ -104,7 +104,7 @@ defmodule CodeStatsWeb.AuthController do
:info,
"A password reset email will be sent shortly to the email address linked to the account, if the account had one. If you do not receive an email, please check that you typed the account name correctly."
)
|> redirect(to: auth_path(conn, :render_forgot))
|> redirect(to: Routes.auth_path(conn, :render_forgot))
end
def render_reset(conn, %{"token" => token}) do
......@@ -135,7 +135,7 @@ defmodule CodeStatsWeb.AuthController do
:success,
"Password reset successfully. You can now log in with the new password."
)
|> redirect(to: auth_path(conn, :render_login))
|> redirect(to: Routes.auth_path(conn, :render_login))
else
_ ->
conn
......@@ -143,7 +143,7 @@ defmodule CodeStatsWeb.AuthController do
:error,
"Unable to reset password. The password reset token may have expired. Please try requesting a new token."
)
|> redirect(to: auth_path(conn, :render_login))
|> redirect(to: Routes.auth_path(conn, :render_login))
end
end
......
......@@ -28,7 +28,7 @@ defmodule CodeStatsWeb.MachineController do
%Machine{} ->
conn
|> put_flash(:success, "Machine added successfully.")
|> redirect(to: machine_path(conn, :list))
|> redirect(to: Routes.machine_path(conn, :list))
%Changeset{} = changeset ->
conn
......@@ -57,7 +57,7 @@ defmodule CodeStatsWeb.MachineController do
conn
|> single_machine_assigns(machine)
|> put_flash(:success, "Machine edited successfully.")
|> redirect(to: machine_path(conn, :view_single, machine.id))
|> redirect(to: Routes.machine_path(conn, :view_single, machine.id))
else
{:error, changeset} ->
conn
......@@ -77,7 +77,7 @@ defmodule CodeStatsWeb.MachineController do
%Machine{} = machine <- edit_api_key_or_flash(conn, changeset) do
conn
|> put_flash(:success, "API key regenerated for machine #{machine.name}.")
|> redirect(to: machine_path(conn, :list))
|> redirect(to: Routes.machine_path(conn, :list))
end
end
......@@ -101,12 +101,12 @@ defmodule CodeStatsWeb.MachineController do
:success,
"The machine has been deactivated and will be deleted in a few moments."
)
|> redirect(to: machine_path(conn, :list))
|> redirect(to: Routes.machine_path(conn, :list))
{:error, _} ->
conn
|> put_flash(:error, "Machine could not be deleted.")
|> redirect(to: machine_path(conn, :list))
|> redirect(to: Routes.machine_path(conn, :list))
end
end
end
......@@ -127,7 +127,7 @@ defmodule CodeStatsWeb.MachineController do
with {:ok, machine} <- do_activate(machine, active) do
conn
|> put_flash(:success, "Machine #{machine.name} #{verb}.")
|> redirect(to: machine_path(conn, :list))
|> redirect(to: Routes.machine_path(conn, :list))
else
{:error, changeset} ->
conn
......@@ -183,7 +183,7 @@ defmodule CodeStatsWeb.MachineController do
{:error, _} ->
conn
|> put_flash(:error, "Error regenerating API key.")
|> redirect(to: machine_path(conn, :list))
|> redirect(to: Routes.machine_path(conn, :list))
end
end
......
......@@ -21,7 +21,7 @@ defmodule CodeStatsWeb.PreferencesController do
%User{} ->
conn
|> put_flash(:success, "Preferences updated!")
|> redirect(to: preferences_path(conn, :edit))
|> redirect(to: Routes.preferences_path(conn, :edit))
%Ecto.Changeset{} = error_changeset ->
conn
......@@ -41,17 +41,17 @@ defmodule CodeStatsWeb.PreferencesController do
%User{} ->
conn
|> put_flash(:success, "Password changed.")
|> redirect(to: preferences_path(conn, :edit))
|> redirect(to: Routes.preferences_path(conn, :edit))
%Ecto.Changeset{} ->
conn
|> put_flash(:error, "Error changing password.")
|> redirect(to: preferences_path(conn, :edit))
|> redirect(to: Routes.preferences_path(conn, :edit))
end
else
conn
|> put_flash(:error, "Old password was wrong!")
|> redirect(to: preferences_path(conn, :edit))
|> redirect(to: Routes.preferences_path(conn, :edit))
end
end
......@@ -60,7 +60,7 @@ defmodule CodeStatsWeb.PreferencesController do
"""
@spec delete(Plug.Conn.t(), map) :: Plug.Conn.t()
def delete(conn, params) do
AuthUtils.delete_user_action(conn, params, {&preferences_path/2, :edit})
AuthUtils.delete_user_action(conn, params, {&Routes.preferences_path/2, :edit})
end
defp common_edit_assigns(conn) do
......
......@@ -8,7 +8,7 @@ defmodule CodeStatsWeb.ProfileController do
def my_profile(conn, _params) do
user = AuthUtils.get_current_user(conn)
redirect(conn, to: profile_path(conn, :profile, user.username))
redirect(conn, to: Routes.profile_path(conn, :profile, user.username))
end
def profile(conn, %{"username" => username}) do
......@@ -165,7 +165,7 @@ defmodule CodeStatsWeb.ProfileController do
end
defp render_or_redirect(conn, user, _, _, redirect_action) do
redirect(conn, to: profile_path(conn, redirect_action, user.username))
redirect(conn, to: Routes.profile_path(conn, redirect_action, user.username))
end
# Fix the username specified in the URL by converting plus characters to spaces.
......
......@@ -30,7 +30,7 @@ defmodule CodeStatsWeb.TermsController do
:ok ->
conn
|> put_flash(:success, "You have accepted the new legal terms.")
|> redirect(to: profile_path(conn, :my_profile))
|> redirect(to: Routes.profile_path(conn, :my_profile))
val ->
Logger.error("Error storing consent: #{inspect(val)}")
......@@ -57,6 +57,6 @@ defmodule CodeStatsWeb.TermsController do
"""
@spec delete_account(Plug.Conn.t(), map) :: Plug.Conn.t()
def delete_account(conn, params) do
AuthUtils.delete_user_action(conn, params, {&terms_path/2, :ask_consent})
AuthUtils.delete_user_action(conn, params, {&Routes.terms_path/2, :ask_consent})
end
end
defmodule CodeStatsWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :code_stats
socket("/live_update_socket", CodeStatsWeb.LiveUpdateSocket)
socket("/live_update_socket", CodeStatsWeb.LiveUpdateSocket, websocket: true)
plug(CodeStatsWeb.RequestTimePlug)
......
<div class="stripe">
<h1>Request a password reset token</h1>
<%= form_for(@changeset, auth_path(@conn, :render_forgot), fn f -> %>
<%= form_for(@changeset, Routes.auth_path(@conn, :render_forgot), fn f -> %>
<label for="username" class="<%= if f.errors[:username], do: "has-error" %>">Username (required)</label>
<div class="input">
<%= text_input(f, :username, required: true) %>
......
......@@ -16,6 +16,6 @@
<h2>Forgot your password?</h2>
<p>
If you forgot your password, <a href="<%= auth_path(@conn, :render_forgot) %>">proceed to the password reset form</a>. If you have not added an email address to your account, it cannot be recovered.
If you forgot your password, <a href="<%= Routes.auth_path(@conn, :render_forgot) %>">proceed to the password reset form</a>. If you have not added an email address to your account, it cannot be recovered.
</p>
</div>
<div class="stripe">
<h1>Reset your password</h1>
<%= form_for(@changeset, auth_path(@conn, :reset, @token), fn f -> %>
<%= form_for(@changeset, Routes.auth_path(@conn, :reset, @token), fn f -> %>
<label for="password" class="<%= if f.errors[:password], do: "has-error" %>">Password (required)</label>
<div class="input">
<%= password_input(f, :password, required: true) %>
......
......@@ -17,7 +17,7 @@
<div class="stripe">
<h2 id="signup-form">Sign up</h2>
<%= form_for(@changeset, auth_path(@conn, :signup) <> "#signup-form", fn f -> %>
<%= form_for(@changeset, Routes.auth_path(@conn, :signup) <> "#signup-form", fn f -> %>
<label for="user_username" class="<%= if f.errors[:username], do: "has-error" %>">Username (required)</label>
<div class="input">
<%= text_input(f, :username, required: true) %>
......
......@@ -35,10 +35,10 @@
<%= if assigns[:id], do: raw(~s(id="#{@id}")), else: "" %>
<%= if assigns[:class], do: raw(~s(class="#{@class}")), else: "" %>
>
<source srcset="<%= static_path(@conn, no_ext <> ".webp") %>" type="image/webp" />
<source srcset="<%= static_path(@conn, @src) %>" type="<%= type %>" />
<source srcset="<%= Routes.static_path(@conn, no_ext <> ".webp") %>" type="image/webp" />
<source srcset="<%= Routes.static_path(@conn, @src) %>" type="<%= type %>" />
<img
src=<%= static_path(@conn, @src) %>
src=<%= Routes.static_path(@conn, @src) %>
alt="<%= @alt %>"
title="<%= @title %>"
<%= if assigns[:img_id], do: raw(~s(id="#{@img_id}")), else: "" %>
......
......@@ -5,7 +5,7 @@
</p>
<p>
<a href="<%= auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>"><%= auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %></a>
<a href="<%= Routes.auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>"><%= Routes.auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %></a>
</p>
<p>
......
A password reset was requested for an account registered with this email address. To reset your password, please open the following link:
<%= auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>
<%= Routes.auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>
This link is valid for <%= CodeStats.User.PasswordReset.token_max_life() %> hours.
......
......@@ -4,9 +4,9 @@
<meta charset="utf-8">
<!-- Preload resources for MAXIMUM SPEED -->
<link rel="preload" href="<%= static_path(@conn, "/css/frontend.css") %>" as="style">
<link rel="preload" href="<%= static_path(@conn, "/js/frontend.js") %>" as="script">
<link rel="preload" href="<%= static_path(@conn, "/assets/frontend/images/Logo.svg") %>" as="image">
<link rel="preload" href="<%= Routes.static_path(@conn, "/css/frontend.css") %>" as="style">
<link rel="preload" href="<%= Routes.static_path(@conn, "/js/frontend.js") %>" as="script">
<link rel="preload" href="<%= Routes.static_path(@conn, "/assets/frontend/images/Logo.svg") %>" as="image">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
......@@ -14,7 +14,7 @@
<meta name="author" content="Mikko Ahlroth">
<title><%= get_title(@conn) %></title>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/frontend.css") %>">
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/frontend.css") %>">
<link rel="apple-touch-icon" sizes="57x57" href="/assets/frontend/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/assets/frontend/apple-touch-icon-60x60.png">
......@@ -44,9 +44,9 @@
<body>
<header id="nav-stripe" class="stripe">
<a id="header-logo" class="logo" href="<%= page_path(@conn, :index) %>">
<a id="header-logo" class="logo" href="<%= Routes.page_path(@conn, :index) %>">
<img
src="<%= static_path(@conn, "/assets/frontend/images/Logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/Logo.svg") %>"
alt="<%= get_conf(:site_name) %> logo"
title="<%= get_conf(:site_name) %>"
/>
......@@ -54,13 +54,13 @@
<nav id="header-nav" role="navigation">
<%= if is_authed?(@conn) do %>
<a href="<%= profile_path(@conn, :my_profile) %>">Profile</a>
<a href="<%= preferences_path(@conn, :edit) %>">Preferences</a>
<a href="<%= machine_path(@conn, :list) %>">Machines</a>
<a href="<%= auth_path(@conn, :logout) %>">Log out</a>
<a href="<%= Routes.profile_path(@conn, :my_profile) %>">Profile</a>
<a href="<%= Routes.preferences_path(@conn, :edit) %>">Preferences</a>
<a href="<%= Routes.machine_path(@conn, :list) %>">Machines</a>
<a href="<%= Routes.auth_path(@conn, :logout) %>">Log out</a>
<% else %>
<a href="<%= auth_path(@conn, :render_login) %>">Log in</a>
<a href="<%= auth_path(@conn, :render_signup) %>">Sign up</a>
<a href="<%= Routes.auth_path(@conn, :render_login) %>">Log in</a>
<a href="<%= Routes.auth_path(@conn, :render_signup) %>">Sign up</a>
<% end %>
</nav>
</header>
......@@ -107,10 +107,10 @@
<footer id="footer-stripe" class="stripe stripe-accent">
<section>
<h6 class="no-margin"><%= CodeStatsWeb.RequestTimePlug.calculate_time(@conn) %>, <%= inspect(self()) %></h6>
<a href="<%= page_path(@conn, :changes)%>"><%= get_conf(:version) %>-<%= get_conf(:commit_hash) %></a>
<a href="<%= page_path(@conn, :plugins) %>">Plugins</a>
<a href="<%= page_path(@conn, :api_docs) %>">API docs</a>
<a href="<%= page_path(@conn, :terms) %>">Legal</a>
<a href="<%= Routes.page_path(@conn, :changes)%>"><%= get_conf(:version) %>-<%= get_conf(:commit_hash) %></a>
<a href="<%= Routes.page_path(@conn, :plugins) %>">Plugins</a>
<a href="<%= Routes.page_path(@conn, :api_docs) %>">API docs</a>
<a href="<%= Routes.page_path(@conn, :terms) %>">Legal</a>
</section>
<%= if not Enum.empty?(get_conf(:social_links)) do %>
......@@ -148,7 +148,7 @@
<script type="text/javascript">
window.moment = {};
</script>
<script async type="text/javascript" src="<%= static_path(@conn, "/js/frontend.js") %>"></script>
<script async type="text/javascript" src="<%= Routes.static_path(@conn, "/js/frontend.js") %>"></script>
<%= raw get_conf(:analytics_code) %>
</body>
</html>
......@@ -8,7 +8,7 @@
<meta name="author" content="Mikko Ahlroth">
<title><%= get_conf(:site_name) %> Battle Mode</title>
<link rel="stylesheet" href="<%= static_path(@conn, "/battle/css/battle.css") %>">
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/battle/css/battle.css") %>">
<link rel="apple-touch-icon" sizes="57x57" href="/frontend/assets/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/frontend/assets/apple-touch-icon-60x60.png">
......@@ -37,7 +37,7 @@
<body>
<%= render @view_module, @view_template, assigns %>
<script type="text/javascript" src="<%= static_path(@conn, "/battle/js/battle.js") %>"></script>
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/battle/js/battle.js") %>"></script>
<%= raw get_conf(:analytics_code) %>
</body>
</html>
......@@ -21,7 +21,7 @@
<hr />
<p>
This email was sent from <a href="<%= page_url(CodeStatsWeb.Endpoint, :index) %>"><%= get_conf(:site_name) %></a>. If you do not wish to receive more emails, you can remove your email address in the preferences page of your account.
This email was sent from <a href="<%= Routes.page_url(CodeStatsWeb.Endpoint, :index) %>"><%= get_conf(:site_name) %></a>. If you do not wish to receive more emails, you can remove your email address in the preferences page of your account.
</p>
<p>
......
......@@ -4,6 +4,6 @@
<%= render @view_module, @view_template, assigns %>
-----------
This email was sent from <%= get_conf(:site_name) %> <<%= page_url(CodeStatsWeb.Endpoint, :index) %>>. If you do not wish to receive more emails, you can remove your email address in the preferences page of your account.
This email was sent from <%= get_conf(:site_name) %> <<%= Routes.page_url(CodeStatsWeb.Endpoint, :index) %>>. If you do not wish to receive more emails, you can remove your email address in the preferences page of your account.
Please note that you cannot reply to this email.
......@@ -12,19 +12,19 @@
<button type="button" class="copy-button">Copy</button>
<%= form_tag(machine_path(@conn, :view_single, machine.id), method: :get, class: "edit-form") %>
<%= form_tag(Routes.machine_path(@conn, :view_single, machine.id), method: :get, class: "edit-form") %>
<button type="submit">Edit</button>
</form>
<%= form_tag(machine_path(@conn, :regen_machine_key, machine.id), class: "regenerate-form") %>
<%= form_tag(Routes.machine_path(@conn, :regen_machine_key, machine.id), class: "regenerate-form") %>
<button type="submit" class="button-warning machine-regenerate-button">Regenerate API key</button>
</form>
<%= form_tag(machine_path(@conn, :deactivate, machine.id), class: "deactivate-form") %>
<%= form_tag(Routes.machine_path(@conn, :deactivate, machine.id), class: "deactivate-form") %>
<button type="submit" class="button-danger machine-deactivate-button">Deactivate</button>
</form>
<%= form_tag(machine_path(@conn, :delete, machine.id), method: :delete, class: "delete-form") %>
<%= form_tag(Routes.machine_path(@conn, :delete, machine.id), method: :delete, class: "delete-form") %>
<button type="submit" class="button-danger machine-delete-button">Delete</button>
</form>
</div>
......@@ -43,7 +43,7 @@
<h2>Add new machine</h2>
<%= form_for(@changeset, machine_path(@conn, :list), fn f -> %>
<%= form_for(@changeset, Routes.machine_path(@conn, :list), fn f -> %>
<label for="machine_name" class="<%= if f.errors[:name], do: "has-error" %>">Name (required)</label>
<div class="input">
......@@ -60,7 +60,7 @@
<div class="inactive-machine-list">
<h2>Inactive machines</h2>
<%= for %{active: false} = machine <- @machines do %>
<%= form_tag(machine_path(@conn, :activate, machine.id), class: "machine") %>
<%= form_tag(Routes.machine_path(@conn, :activate, machine.id), class: "machine") %>
<div class="machine-name"><%= machine.name %></div>
<button type="submit">Activate</button>
</form>
......
<div class="stripe">
<h1>Machine: <%= @machine.name %></h1>
<%= form_for(@changeset, machine_path(@conn, :edit, @machine.id), fn f -> %>
<%= form_for(@changeset, Routes.machine_path(@conn, :edit, @machine.id), fn f -> %>
<label for="machine_name" class="<%= if f.errors[:name], do: "has-error" %>">Name (required)</label>
<div class="input">
......@@ -15,6 +15,6 @@
<% end) %>
<p>
<a class="btn btn-default" href="<%= machine_path(@conn, :list) %>">&laquo; Back to machine list</a>
<a class="btn btn-default" href="<%= Routes.machine_path(@conn, :list) %>">&laquo; Back to machine list</a>
</p>
</div>
......@@ -115,7 +115,7 @@ int get_level(float xp) {
</h2>
<p>
Code::Stats uses simple token authentication. A single token authenticates both a user and the machine they are using. It is signed to prevent tampering and unauthorized creation of tokens matching other users' information. To generate a token, you need to create a new machine from the <a href="<%= machine_path(@conn, :list) %>">Machine control panel</a>. A token looks like this:
Code::Stats uses simple token authentication. A single token authenticates both a user and the machine they are using. It is signed to prevent tampering and unauthorized creation of tokens matching other users' information. To generate a token, you need to create a new machine from the <a href="<%= Routes.machine_path(@conn, :list) %>">Machine control panel</a>. A token looks like this:
</p>
<pre><code>SFMyNTY.OEotWWdnPT0jI01qaz0.X0wVEZquh8Ogau1iTtBihYqqL71FD8N6p5ChQiIpaxQ</code></pre>
......@@ -141,7 +141,7 @@ int get_level(float xp) {
</h3>
<p>
<code>GET <%= profile_path(@conn, :profile_api, "username") %></code>
<code>GET <%= Routes.profile_path(@conn, :profile_api, "username") %></code>
</p>
<p>
......@@ -197,7 +197,7 @@ int get_level(float xp) {
</h3>
<p>
<code>POST <%= pulse_path(@conn, :add) %></code>
<code>POST <%= Routes.pulse_path(@conn, :add) %></code>
</p>
<p>
......
......@@ -35,7 +35,7 @@
</div>
<div>
<img src="<%= static_path(@conn, "/assets/frontend/images/Logo.svg") %>" alt="Code::Stats logo" />
<img src="<%= Routes.static_path(@conn, "/assets/frontend/images/Logo.svg") %>" alt="Code::Stats logo" />
<h3>Hannu Hartikainen</h3>
<p class="subtitle">
......@@ -223,7 +223,7 @@
<ul>
<li>Added a language alias feature. Now some languages are just aliases for others. This is done to fix typos and problems in language detection in editors. For example, "JavaScript 1.5" (which was released in 2000 and is erroneously detected by JetBrains in some situations) will now be corrected to "JavaScript" and all existing XP has been combined between the languages. If you have feedback or suggestions on languages to merge, give us feedback on our Gitter or IRC channel.</li>
<li>Added information about Gitter channel into footer, removed useless contact page.</li>
<li>Added user profile API for fetching data of public users. Integrate Code::Stats with your website! Check the <a href="<%= page_path(@conn, :api_docs) %>">API documentation</a> for more information.</li>
<li>Added user profile API for fetching data of public users. Integrate Code::Stats with your website! Check the <a href="<%= Routes.page_path(@conn, :api_docs) %>">API documentation</a> for more information.</li>
</ul>
<h3>1.7.2 – 2016-09-12 – Machine API key and caching duration stuff</h3>
......
......@@ -19,7 +19,7 @@
</p>
<p>
<a href="<%= page_path(@conn, :plugins) %>">See available plugins →</a>
<a href="<%= Routes.page_path(@conn, :plugins) %>">See available plugins →</a>
</p>
</section>
<section class="frontpage-ad">
......@@ -39,7 +39,7 @@
</p>
<p>
<a href="<%= profile_path(@conn, :profile, "Nicd") %>">
<a href="<%= Routes.profile_path(@conn, :profile, "Nicd") %>">
See example profile →
</a>
</p>
......
......@@ -21,7 +21,7 @@
<a href="#atom">
<img
class="plugin-image"
src="<%= static_path(@conn, "/assets/frontend/images/atom-logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/atom-logo.svg") %>"
title="Atom editor"
alt="Atom editor logo"
/>
......@@ -29,7 +29,7 @@
<a href="#jetbrains">
<img
class="plugin-image"
src="<%= static_path(@conn, "/assets/frontend/images/jetbrains-logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/jetbrains-logo.svg") %>"
title="JetBrains"
alt="JetBrains logo"
/>
......@@ -46,7 +46,7 @@
<a href="#vs">
<img
class="plugin-image"
src="<%= static_path(@conn, "/assets/frontend/images/vs-logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/vs-logo.svg") %>"
title="Visual Studio"
alt="Visual Studio logo"
/>
......@@ -66,7 +66,7 @@
</p>
<p>
Note that <em>at no point is any of your code sent to <%= get_conf(:site_name) %></em>. Only the amounts of XP (roughly the amount of keystrokes) are sent. For further information, check the <a href="<%= page_path(@conn, :api_docs) %>">API documentation</a> and the source code of the plugins.
Note that <em>at no point is any of your code sent to <%= get_conf(:site_name) %></em>. Only the amounts of XP (roughly the amount of keystrokes) are sent. For further information, check the <a href="<%= Routes.page_path(@conn, :api_docs) %>">API documentation</a> and the source code of the plugins.
</p>
<hr />
......@@ -86,7 +86,7 @@
<img
class="plugin-image"
src="<%= static_path(@conn, "/assets/frontend/images/atom-logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/atom-logo.svg") %>"
title="Atom editor"
alt="Atom editor logo"
/>
......@@ -115,7 +115,7 @@ $ bin/keytool -import -alias 'DST Root CA X3' -keystore lib/security/cacerts -tr
<img
class="plugin-image"
src="<%= static_path(@conn, "/assets/frontend/images/jetbrains-logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/jetbrains-logo.svg") %>"
title="JetBrains"
alt="JetBrains logo"
/>
......@@ -188,7 +188,7 @@ $ bin/keytool -import -alias 'DST Root CA X3' -keystore lib/security/cacerts -tr
<img
class="plugin-image"
src="<%= static_path(@conn, "/assets/frontend/images/vs-logo.svg") %>"
src="<%= Routes.static_path(@conn, "/assets/frontend/images/vs-logo.svg") %>"
title="Visual Studio"
alt="Visual Studio logo"
/>
......@@ -235,7 +235,7 @@ $ bin/keytool -import -alias 'DST Root CA X3' -keystore lib/security/cacerts -tr
<h2 class="media-heading">Other editors</h2>
<p>
If there is no plugin for your favourite editor, you can check out the <a href="<%= page_path(@conn, :api_docs) %>">API docs</a> and implement one yourself. If you do, please let us know so we can add a link to it here!
If there is no plugin for your favourite editor, you can check out the <a href="<%= Routes.page_path(@conn, :api_docs) %>">API docs</a> and implement one yourself. If you do, please let us know so we can add a link to it here!
</p>
</div>
......
......@@ -7,7 +7,7 @@
<div id="user-details">
<h2>User details</h2>
<%= form_for(@changeset, preferences_path(@conn, :do_edit), fn f -> %>
<%= form_for(@changeset, Routes.preferences_path(@conn, :do_edit), fn f -> %>
<label for="user_email" class="<%= if f.errors[:email], do: "has-error" %>">Email address</label>
<div class="input">
<%= email_input(f, :email) %>
......@@ -35,7 +35,7 @@
<div id="change-password" class="stripe">
<h2>Change password</h2>
<%= form_tag(preferences_path(@conn, :change_password)) %>
<%= form_tag(Routes.preferences_path(@conn, :change_password)) %>
<label for="old_password" class="<%= if assigns[:old_password_error], do: "has-error" %>">Old password (required)</label>
<div class="input">
<input type="password" id="old_password" name="old_password" required />
......@@ -63,7 +63,7 @@
<p>
Press the button below to download your XP data in CSV format. You can also include all
private data contained in the service about your account. See the
<a href="<%= page_path(@conn, :terms) %>">privacy policy</a> for more information.
<a href="<%= Routes.page_path(@conn, :terms) %>">privacy policy</a> for more information.
</p>
<form>
......@@ -87,7 +87,7 @@
the delete button. If you do this, all your data will be removed and cannot be recovered.