Add registration by login and password #63
Add registration by login and password #63
Conversation
|> subject(subject) | ||
|> put_html_layout({HexletBasicsWeb.LayoutView, "email.html"}) | ||
|> render( | ||
"user/reset_password.#{locale}.html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
если не будет такого файла? мне кажется, ты даже не узнаешь об этом
end | ||
|
||
defp sending_from(conn) do | ||
"noreply@#{conn.host}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот это не очень хорошо. лучше брать адрес из конфига.
ты отрезаешь себе возможность отправлять письма вне http-запроса
conn | ||
|> put_flash(:info, gettext("Message with instructions for reset password was sent")) | ||
|> redirect(to: "/") | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот этот кусок третий раз вижу. можно вынести в plug
|
||
def delete(conn, _params) do | ||
conn | ||
|> put_flash(:info, gettext "You have been logged out!") | ||
|> configure_session(drop: true) | ||
|> redirect(to: "/") | ||
end | ||
|
||
defp check_authentication(conn, _options) do | ||
%{assigns: %{current_user: current_user}} = conn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно прямо в параметрах паттерн-матчить
case Repo.insert(changeset) do | ||
{:ok, user} -> | ||
|
||
# TODO: пока отключил посылку писем с потдверждением |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сделай ишью, не оставляй мусор в коде
@@ -0,0 +1,5 @@ | |||
defmodule HexletBasicsWeb.Helpers.CustomUrl do | |||
def build_url(conn, path) do | |||
"#{conn.scheme}://#{conn.host}#{path}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот не люблю я полагаться на host
. Так-то он из заголовков берется. Его можно любой подсунуть. Если твой nginx не настроен специальным образом, то он тебе от пользуна тут может вообще что угодно прилететь
end | ||
end | ||
|
||
defp check_authentication(conn, options) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Судя по всему этот плаг можно расширить.
@@ -2,6 +2,10 @@ defmodule HexletBasicsWeb.Router do | |||
use HexletBasicsWeb, :router | |||
use Plug.ErrorHandler | |||
|
|||
if Mix.env == :dev do | |||
forward "/sent_emails", Bamboo.SentEmailViewerPlug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Из любимого Кирилла
No description provided.