Skip to content

Commit

Permalink
Remove account confirmation logic from Jobseekers
Browse files Browse the repository at this point in the history
Confirmation of the account/new email/etc is managed by GovUK OneLogin.
  • Loading branch information
scruti committed Oct 9, 2024
1 parent 9a708fc commit 9924c61
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 200 deletions.
2 changes: 0 additions & 2 deletions app/controllers/jobseekers/accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class Jobseekers::AccountsController < Jobseekers::BaseController
def show; end

def confirmation; end

def account_found; end

def account_not_found; end
Expand Down
45 changes: 0 additions & 45 deletions app/controllers/jobseekers/confirmations_controller.rb

This file was deleted.

15 changes: 2 additions & 13 deletions app/controllers/jobseekers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ def check_your_email
@resource = Jobseeker.find_by(id: session[:jobseeker_id])
end

def resend_instructions
if session[:jobseeker_id].blank?
redirect_to new_jobseeker_confirmation_path
else
@resource = Jobseeker.find(session[:jobseeker_id])
@resource.send_confirmation_instructions
flash[:success] = t("jobseekers.registrations.check_your_email.resent_email_confirmation")
render :check_your_email
end
end

protected

def check_password_difference
Expand Down Expand Up @@ -81,8 +70,8 @@ def after_inactive_sign_up_path_for(resource)
jobseekers_check_your_email_path
end

def after_update_path_for(resource)
resource.pending_reconfirmation? && !password_update? ? jobseekers_check_your_email_path : jobseekers_account_path
def after_update_path_for(_resource)
jobseekers_account_path
end

def close_account_feedback_form_params
Expand Down
5 changes: 0 additions & 5 deletions app/helpers/notify_views_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ def choose_organisation_link(token)
notify_link(url)
end

def email_confirmation_url(token)
url = jobseeker_confirmation_url(confirmation_token: token, **utm_params)
notify_link(url)
end

def expired_vacancy_feedback_link(vacancy)
url = new_organisation_job_expired_feedback_url(vacancy.signed_id)
notify_link(url, I18n.t("publishers.expired_vacancy_feedback_prompt_mailer.feedback_link_text"))
Expand Down
29 changes: 1 addition & 28 deletions app/mailers/jobseekers/devise_emails.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
module Jobseekers::DeviseEmails
def confirmation_instructions(record, token, _opts = {})
to = subject = nil

if !record.confirmed? && record.confirmation_sent_at < 12.hours.ago
to = record.unconfirmed_email
subject = t(".reminder.subject")
@confirmation_type = ".reminder"
elsif record.pending_reconfirmation?
to = record.unconfirmed_email
subject = t(".reconfirmation.subject")
@confirmation_type = ".reconfirmation"
end

send_email(
jobseeker: record,
subject: subject,
template: template,
to: to,
token: token,
)
end

def email_changed(record, _opts = {})
send_email(
jobseeker: record,
Expand Down Expand Up @@ -52,11 +30,6 @@ def send_email(template:, jobseeker:, token: nil, to: nil, subject: nil)
end

def dfe_analytics_custom_data
case action_name
when "confirmation_instructions"
@jobseeker.pending_reconfirmation? ? { previous_email_identifier: DfE::Analytics.anonymise(@jobseeker.email) } : {}
else
{}
end
{}
end
end
5 changes: 0 additions & 5 deletions app/models/jobseeker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class Jobseeker < ApplicationRecord
has_encrypted :last_sign_in_ip, :current_sign_in_ip

devise(*%I[
confirmable
database_authenticatable
registerable
timeoutable
Expand Down Expand Up @@ -30,10 +29,6 @@ def account_closed?
!!account_closed_on
end

def needs_email_confirmation?
!confirmed? || unconfirmed_email.present?
end

def self.create_from_govuk_one_login(email:, govuk_one_login_id:)
return unless email.present? && govuk_one_login_id.present?

Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions app/views/jobseekers/confirmations/_new_hidden_email.html.slim

This file was deleted.

11 changes: 0 additions & 11 deletions app/views/jobseekers/confirmations/_new_with_email.html.slim

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions app/views/jobseekers/confirmations/new.html.slim

This file was deleted.

7 changes: 0 additions & 7 deletions app/views/jobseekers/confirmations/show.html.slim

This file was deleted.

2 changes: 0 additions & 2 deletions config/locales/devise.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ en:
already_signed_out: Signed out successfully.
errors:
messages:
already_confirmed: was already confirmed, please try signing in
confirmation_period_expired: needs to be confirmed within %{period}, please request a new one
expired: has expired, please request a new one
not_found: not found
not_saved:
Expand Down
14 changes: 0 additions & 14 deletions config/locales/jobseekers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,6 @@ en:
account_survey:
survey_link_text: Give feedback
survey_text: Take our quick survey about your experience of using Teaching Vacancies
confirmations:
already_confirmed:
description: Your email address has already been confirmed.
title: Email already confirmed
new_with_email:
description: We need to email another link so you can activate your account.
title: Resend confirmation
new_hidden_email:
description: We need to email another link to %{email} so you can activate your account.
title: Link has expired
show:
confirm: Confirm
title: Confirm your email address
employments:
break: Gap in work history
current_role: Is this your current role?
Expand Down Expand Up @@ -567,7 +554,6 @@ en:
resend_link: resend the email
restart_link: provide another email address
title: Check your email
resent_email_confirmation: Email has been resent
confirm_destroy:
feedback_title: Tell us why you are closing your account
page_title: Close account
Expand Down
32 changes: 0 additions & 32 deletions spec/models/jobseeker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,6 @@
end
end

describe "#needs_email_confirmation?" do
subject(:jobseeker) { build_stubbed(:jobseeker) }

context "when the user is confirmed" do
before { jobseeker.confirmed_at = Time.current }

context "when the user does not have a new unconfirmed email address" do
before { jobseeker.unconfirmed_email = nil }
it { is_expected.not_to be_needs_email_confirmation }
end

context "when the user has a new unconfirmed email address" do
before { jobseeker.unconfirmed_email = "[email protected]" }
it { is_expected.to be_needs_email_confirmation }
end
end

context "when the user is not confirmed" do
before { jobseeker.confirmed_at = nil }

context "when the user does not have a new unconfirmed email address" do
before { jobseeker.unconfirmed_email = nil }
it { is_expected.to be_needs_email_confirmation }
end

context "when the user has a new unconfirmed email address" do
before { jobseeker.unconfirmed_email = "[email protected]" }
it { is_expected.to be_needs_email_confirmation }
end
end
end

describe ".create_from_govuk_one_login" do
let(:email) { "[email protected]" }
let(:govuk_one_login_id) { "urn:fdc:gov.uk:2022:VtcZjnU4Sif2oyJZola3OkN0e3Jeku1cIMN38rFlhU4" }
Expand Down

0 comments on commit 9924c61

Please sign in to comment.