Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1101 andi auth error page #1665

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/andi/assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ body {
}

@import "./access-groups.scss";
@import "./autherror.scss";
@import "./button.scss";
@import "./data_dictionary_form.scss";
@import "./datasets.scss";
Expand Down
19 changes: 19 additions & 0 deletions apps/andi/assets/css/autherror.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.autherror-view {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: rgb(88, 95, 99);
height: 100vh;
width: 100vw;
}

.autherror-inner-content {
background: $color-content-background;
box-shadow: $box-shadow;
height: max-content;
width: max-content;
margin: 1em;
padding: 2em;
border-radius: 6px;
}
2 changes: 1 addition & 1 deletion apps/andi/lib/andi_web/controllers/auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule AndiWeb.AuthController do
Logger.error("Failed to retrieve auth credentials: #{inspect(fails)} with params #{inspect(params)}")

conn
|> redirect(to: "/")
|> redirect(to: "/autherror")
end

def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
Expand Down
23 changes: 23 additions & 0 deletions apps/andi/lib/andi_web/live/error_live_view/error_live_view.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule AndiWeb.ErrorLiveView do
use AndiWeb, :live_view

access_levels(render: [:public, :private])

def render(assigns) do
~L"""
<div class="content">
<main aria-label="Error Page" class="autherror-view">
<div class="autherror-inner-content">
<h3>Login Unsuccessful</h3>
<p>You do not have permission to access this system.</p>
<a href="/">Click here to return to login</a>
</div>
</main>
</div>
"""
end

def mount(_params, socket) do
{:ok, socket}
end
end
5 changes: 5 additions & 0 deletions apps/andi/lib/andi_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,9 @@ defmodule AndiWeb.Router do
scope "/", AndiWeb do
get "/healthcheck", HealthCheckController, :index
end

scope "/", AndiWeb do
pipe_through :browser
live "/autherror", ErrorLiveView, layout: {AndiWeb.LayoutView, :app}
end
end
2 changes: 1 addition & 1 deletion apps/andi/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Andi.MixProject do
def project do
[
app: :andi,
version: "2.6.62",
version: "2.6.63",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down