Skip to content

Commit e3a8c64

Browse files
committed
make send email on account merge
1 parent 936a4e1 commit e3a8c64

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

framework/auth/views.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def send_confirm_email(user, email, renew=False, external_id_provider=None, exte
832832
merge_target = OSFUser.objects.get(emails__address=email)
833833
except OSFUser.DoesNotExist:
834834
merge_target = None
835-
835+
merge_account_data = {}
836836
campaign = campaigns.campaign_for_user(user)
837837
# Choose the appropriate email template to use and add existing_user flag if a merge or adding an email.
838838
if external_id_provider and external_id:
@@ -845,6 +845,11 @@ def send_confirm_email(user, email, renew=False, external_id_provider=None, exte
845845
raise HTTPError(http_status.HTTP_400_BAD_REQUEST, data={})
846846
elif merge_target:
847847
# Merge account confirmation
848+
merge_account_data = {
849+
'merge_target_fullname': merge_target.fullname or merge_target.username,
850+
'user_username': user.fullname,
851+
'email': merge_target.email,
852+
}
848853
notification_type = NotificationType.Type.USER_CONFIRM_MERGE
849854
elif user.is_active:
850855
# Add email confirmation
@@ -866,6 +871,7 @@ def send_confirm_email(user, email, renew=False, external_id_provider=None, exte
866871
'external_id_provider': external_id_provider,
867872
'osf_contact_email': settings.OSF_CONTACT_EMAIL,
868873
'osf_support_email': settings.OSF_SUPPORT_EMAIL,
874+
**merge_account_data,
869875
},
870876
)
871877

website/templates/confirm_merge.html.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<td style="border-collapse: collapse;">
66
Hello ${merge_target_fullname},<br>
77
<br>
8-
This email is to notify you that ${user_username} has initiated an account merge with your account on the Open Science Framework (OSF). This merge will move all of the projects and components associated with ${email} and with ${user_username} into one account. All projects and components will be displayed under ${user.username}.<br>
8+
This email is to notify you that ${user_username} has initiated an account merge with your account on the Open Science Framework (OSF). This merge will move all of the projects and components associated with ${email} and with ${user_username} into one account. All projects and components will be displayed under ${user_username}.<br>
99
<br>
1010
Both ${user_username} and ${email} can be used to log into the account. However, ${email} will no longer show up in user search.<br>
1111
<br>

0 commit comments

Comments
 (0)