-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account/Watchlist/Notifications (#13)
* Auth for debug Fix for Auth callback calls endless cycle * Logout from auth0 and add profile picture Fix styles in signin/signout * Add profile * Update dockerfiles * Make auth paths dependent of API_PATH * Change api_path to network_path * Save identity from auth into DB * Hardcode urls to make it work again Style fixes * Change sign_in icon * Create Watchlist together with identity * Add watchlist show * Add watchlist addresses Fix creating account on first login Make address as it should look like * Associate watchlist with addresses * Create watchlist address UI Add balance in coin (need to use right coin) * Add tokens on watchlist Fix warnings Fix topnav styles * Add watch_ and notify_ fields in WatchlistAddress * Notifications draft Style fixes Removed divider Watchlist Address Form: ERC-721 & ERC-1155 -> NFT Form style -> modal Move Auth into Account module Add any valid address to watchlist Fix profile namespace in router Fixes in build Notification Fixed insert notifications * Send Emails via SendGrid * Add AUTH0 & SENDGRID API keys to Makefile * Finish email variables Fix warnings Add links to email * Update & Delete Watchlist Addresses Fix styles Fix warnings * Authorize create/update watchlist_address Fix credo warnings * Refactoring and fix UI * Introduce sender & template ENVs * Fix credo warns * Fix formatter & dialyzer * Make Notifier main entrypoint * Fix tests * Fix comments * Hardcode auth0 callbacks for prod env Export it in dev env and it should work: ``` export AUTH0_CALLBACK_URL='http://localhost:4000/auth/auth0/callback' export AUTH0_LOGOUT_RETURN_URL='http://localhost:4000/auth/logout' ``` * Style fixes * Private tags on address/transaction/token pages * Add account logger * fix email subject * Fix token_transfers notifications * Prepare for release * Fix transaction dropdown * Remoe unwanted changes * Reset CI cache * Fix Dialyzer, gettext * Add logout_return_to_url to :ueberauth config for test env * Invalidate GA cache * Redefine sign_in_link for test env * Fix adding address with disabled checkboxes Remove testnet hardcode from prod config CI fix attempt * Add AUTH0_LOGOUT_URL env * Fix logger warning * current_user/1, check that mapping contains :current_user object before executing get_session function * Fix current_user * Final fix of current_user/1 * Introduce COIN_NAME env * Lowercase hashes in email * Style fix * Add block_url to email * Fix creating notifications for NFT * Add notifier to token_transfers import runner * Add processing transfer into Notifier * Fix token transfer summary * WIP: Account refactoring (#19) * Move Ueberauth settings to config.exs * Make AuthController more clear * Fix error when build_watchlist_notification returns nil * Set WatchlistAddressForm defaults * Style fix * Fix double send email for tokens * Style fix WatchlistController * Style fix AddWatchlistAddress * Style fix UserFromAuth * Use Logger instead AccountLogger * Credo fix * Fix AddWatchlistAddress * Fix Notifier Co-authored-by: Oleg Sovetnik <sovetnik@oblaka.biz> Co-authored-by: nikitosing <nikitosing4@mail.ru>
- Loading branch information
1 parent
330be4e
commit cde1bb6
Showing
95 changed files
with
3,208 additions
and
697 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
div.divider { | ||
height: inherit; | ||
width: 1px; | ||
background: #828ba0; | ||
margin-left: 10px; | ||
margin-right: 10px; | ||
} | ||
|
||
input.profile-item { | ||
margin-left: 10px; | ||
color: #828ba0; | ||
outline: none; | ||
} | ||
|
||
.header-account { | ||
font-size: 18px; | ||
} | ||
|
||
.label-account { | ||
font-size: 1rem; | ||
} | ||
|
||
.white { | ||
color: #fff; | ||
} | ||
|
||
.card-body-account { | ||
max-width: none !important; | ||
} | ||
|
||
.form-input { | ||
display: flex; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.form-checkbox { | ||
margin-right: 0.5rem; | ||
align-self: center; | ||
} | ||
|
||
.label-checkbox { | ||
font-size: 14px; | ||
margin-bottom: 0; | ||
} | ||
|
||
.o-flow-x { | ||
overflow-x: auto; | ||
} | ||
|
||
.fs-14 { | ||
font-size: 14px; | ||
} | ||
|
||
.acc-link-active { | ||
&:hover, &:focus { | ||
background-color: $primary !important; | ||
color: #fff !important; | ||
} | ||
background-color: $primary; | ||
color: #fff; | ||
} | ||
|
||
.table-watchlist { | ||
margin: 30px; | ||
|
||
@include media-breakpoint-down(md) { | ||
margin: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
apps/block_scout_web/lib/block_scout_web/controllers/account/auth_controller.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
defmodule BlockScoutWeb.Account.AuthController do | ||
use BlockScoutWeb, :controller | ||
|
||
plug(Ueberauth) | ||
|
||
def logout(conn, _params) do | ||
conn | ||
# |> put_flash(:info, "You have been logged out!") | ||
|> configure_session(drop: true) | ||
|> redirect(to: root()) | ||
end | ||
|
||
def profile(conn, _params), | ||
do: conn |> get_session(:current_user) |> do_profile(conn) | ||
|
||
defp do_profile(nil, conn), | ||
do: redirect(conn, to: root()) | ||
|
||
defp do_profile(%{} = user, conn), | ||
do: render(conn, :profile, user: user) | ||
|
||
def callback(%{assigns: %{ueberauth_failure: _fails}} = conn, _params) do | ||
conn | ||
|> put_flash(:error, "Failed to authenticate.") | ||
|> redirect(to: root()) | ||
end | ||
|
||
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do | ||
case UserFromAuth.find_or_create(auth) do | ||
{:ok, user} -> | ||
conn | ||
# |> put_flash(:info, "Successfully authenticated as " <> user.name <> ".") | ||
|> put_session(:current_user, user) | ||
|> redirect(to: root()) | ||
|
||
{:error, reason} -> | ||
conn | ||
|> put_flash(:error, reason) | ||
|> redirect(to: root()) | ||
end | ||
end | ||
|
||
# for importing in other controllers | ||
def authenticate!(conn) do | ||
current_user(conn) || redirect(conn, to: root()) | ||
end | ||
|
||
def current_user(%{private: %{plug_session: %{"current_user" => _}}} = conn), | ||
do: get_session(conn, :current_user) | ||
|
||
def current_user(_), do: nil | ||
|
||
defp root do | ||
System.get_env("NETWORK_PATH") || "/" | ||
end | ||
end |
Oops, something went wrong.