[bbb-greenlight: 15/39] Fixed 404 when resending verification email (#2110)
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bbb-greenlight: 15/39] Fixed 404 when resending verification email (#2110)
- Date: Thu, 15 Oct 2020 07:11:22 +0000 (UTC)
commit 816cefe1b63e104818803189ff0963755643d19b
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date: Mon Sep 21 15:32:05 2020 -0400
Fixed 404 when resending verification email (#2110)
app/controllers/account_activations_controller.rb | 17 ++++++++++-------
app/views/account_activations/show.html.erb | 2 +-
2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/app/controllers/account_activations_controller.rb
b/app/controllers/account_activations_controller.rb
index 3956b3b..0174dcd 100644
--- a/app/controllers/account_activations_controller.rb
+++ b/app/controllers/account_activations_controller.rb
@@ -20,8 +20,7 @@ class AccountActivationsController < ApplicationController
include Emailer
before_action :ensure_unauthenticated
- before_action :find_user, except: :show
- before_action :find_user_by_digest, only: :show
+ before_action :find_user
# GET /account_activations
def show
@@ -45,7 +44,7 @@ class AccountActivationsController < ApplicationController
end
end
- # GET /account_activations/resend
+ # POST /account_activations/resend
def resend
if @user.activated?
# User is already verified
@@ -61,11 +60,15 @@ class AccountActivationsController < ApplicationController
private
def find_user
- @user = User.find_by!(activation_digest: User.hash_token(params[:token]), provider: @user_domain)
- end
+ digest = if params[:token].present?
+ User.hash_token(params[:token])
+ elsif params[:digest].present?
+ params[:digest]
+ else
+ raise "Missing token/digest params"
+ end
- def find_user_by_digest
- @user = User.find_by!(activation_digest: params[:digest], provider: @user_domain)
+ @user = User.find_by!(activation_digest: digest, provider: @user_domain)
end
def ensure_unauthenticated
diff --git a/app/views/account_activations/show.html.erb b/app/views/account_activations/show.html.erb
index c2ab1b5..317ee87 100644
--- a/app/views/account_activations/show.html.erb
+++ b/app/views/account_activations/show.html.erb
@@ -22,7 +22,7 @@
<div class="card-body">
<p><%= t("verify.not_verified") %></p>
<div class="btn-list text-right pt-8">
- <%= button_to t("verify.resend"), resend_email_path, params: { token: params['token'],
email_verified: false }, class: "btn btn-primary btn-space", "data-disable": "" %>
+ <%= button_to t("verify.resend"), resend_email_path, params: { digest: params[:digest],
email_verified: false }, class: "btn btn-primary btn-space", "data-disable": "" %>
</div>
</div>
</div>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]