mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	fix: Update the link used for email address change in the confirmation mail (#5937)
This commit is contained in:
		| @@ -11,9 +11,11 @@ | ||||
| <p>You can confirm your account email through the link below:</p> | ||||
| <% end %> | ||||
|  | ||||
| <% if @resource.confirmed? %> | ||||
| <% if @resource.unconfirmed_email.present? %> | ||||
| <p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p> | ||||
| <% elsif @resource.confirmed? %> | ||||
| <p><%= link_to 'Login to my account', frontend_url('auth/sign_in') %></p> | ||||
| <% elsif account_user&.inviter.present? && @resource.unconfirmed_email.blank?  %> | ||||
| <% elsif account_user&.inviter.present? %> | ||||
| <p><%= link_to 'Confirm my account', frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %></p> | ||||
| <% else %> | ||||
| <p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p> | ||||
|   | ||||
| @@ -63,6 +63,21 @@ RSpec.describe 'Confirmation Instructions', type: :mailer do | ||||
|       end | ||||
|     end | ||||
|  | ||||
|     context 'when user is confirmed and updates the email' do | ||||
|       before do | ||||
|         confirmable_user.confirm | ||||
|         confirmable_user.update!(email: 'user@example.com') | ||||
|       end | ||||
|  | ||||
|       it 'sends a confirmation link' do | ||||
|         confirmation_mail = Devise::Mailer.confirmation_instructions(confirmable_user.reload, nil, {}) | ||||
|  | ||||
|         expect(confirmation_mail.body).to include('app/auth/confirmation?confirmation_token') | ||||
|         expect(confirmation_mail.body).not_to include('app/auth/password/edit') | ||||
|         expect(confirmable_user.unconfirmed_email.blank?).to be false | ||||
|       end | ||||
|     end | ||||
|  | ||||
|     context 'when user already confirmed' do | ||||
|       before do | ||||
|         confirmable_user.confirm | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 OMAR.A
					OMAR.A