Skip to content

Commit

Permalink
Inform unverified users trying to authorise with oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
MacTwister committed Nov 21, 2023
1 parent 039f69f commit dc22a81
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
33 changes: 33 additions & 0 deletions app/views/doorkeeper/authorizations/unverified.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<header class="page-header" role="banner">
<div class="text-center">
<%= link_to root_path do %>
<%= image_tag ("logo.svg"), :alt => "fablabs.io" %>
<% end %>
</div>
<h1 class="mt-3">Your Account is Unverified</h1>
</header>

<main role="main">
<p>
Please check your inbox <strong><%= current_user.email %></strong> and validate your email address.
</p>

<div class="actions">
<p class="mb-4 text-center text-info">
It may take a few minutes to reach you. Before we send another, have you checked your spam folder?
</p>

<%= link_to "Resend Verification Code", resend_verification_email_path, class: "btn btn-success btn-lg btn-block" %>

<p class="mt-4 text-center text-info">
If these steps do not work for you, please write to administrators at:&nbsp;<a href="mailto:[email protected]">[email protected]</a>
</p>
</div>
</main>

<!---
Please check your inbox
strong current_user.email
and validate your email address.
confirm: ""
-->
8 changes: 5 additions & 3 deletions config/initializers/doorkeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
if current_user and current_user.verified?
current_user
else
if !current_user
redirect_to(signin_url(goto: request.fullpath))
elsif current_user.unverified?
render 'doorkeeper/authorizations/unverified'
else
current_user
end
end

Expand Down

0 comments on commit dc22a81

Please sign in to comment.