diff --git a/app/views/teachers/mailer/magic_link.text.erb b/app/views/teachers/mailer/magic_link.text.erb index 60cf8465f..96e93b9e8 100644 --- a/app/views/teachers/mailer/magic_link.text.erb +++ b/app/views/teachers/mailer/magic_link.text.erb @@ -6,7 +6,6 @@ Thank you for your interest in applying for qualified teacher status (QTS) in En Welcome back to apply for qualified teacher status (QTS) in England. Use the link below to confirm your email address and sign in to your application. <% end %> -<%= teacher_magic_link_url(token: @token) %> [Confirm your email address](<%= teacher_magic_link_url(token: @token) %>) Please note, this link will expire in <%= Devise.passwordless_login_within.inspect %>. After that time, you will need to [return to the service](<%= create_or_new_teacher_session_url %>) and request another confirmation link. diff --git a/spec/system/teacher_interface/authentication_spec.rb b/spec/system/teacher_interface/authentication_spec.rb index 76c0545f1..3c42b2fc7 100644 --- a/spec/system/teacher_interface/authentication_spec.rb +++ b/spec/system/teacher_interface/authentication_spec.rb @@ -182,7 +182,9 @@ def and_i_receive_a_teacher_magic_link_email def when_i_sign_in_using_magic_link message = ActionMailer::Base.deliveries.last - uri = URI.parse(message.body.raw_source.lines.fifth.chomp) + link_line = message.body.raw_source.lines.fifth.chomp + url = link_line.match(/\((http[^)]+)\)/)[1] + uri = URI.parse(url) expect(uri.path).to eq("/teacher/magic_link") expect(uri.query).to include("token") visit "#{uri.path}?#{uri.query}"