@@ -119,18 +119,26 @@ def send_email_with_callback_token(user, email_token, **kwargs):
119
119
# Get email subject and message
120
120
email_subject = kwargs .get ('email_subject' ,
121
121
api_settings .PASSWORDLESS_EMAIL_SUBJECT )
122
+ user_email = getattr (user , api_settings .PASSWORDLESS_USER_EMAIL_FIELD_NAME )
123
+
122
124
email_plaintext = kwargs .get ('email_plaintext' ,
123
125
api_settings .PASSWORDLESS_EMAIL_PLAINTEXT_MESSAGE )
126
+ if api_settings .PASSWORDLESS_EMAIL_PLAINTEXT_MESSAGE_ORDERED_CONTEXT :
127
+ string_options = tuple ()
128
+ for x in api_settings .PASSWORDLESS_EMAIL_PLAINTEXT_MESSAGE_ORDERED_CONTEXT :
129
+ string_options = string_options + (eval (x ),)
130
+ else :
131
+ email_plaintext = email_plaintext % email_token .key
132
+
124
133
email_html = kwargs .get ('email_html' ,
125
134
api_settings .PASSWORDLESS_EMAIL_TOKEN_HTML_TEMPLATE_NAME )
126
135
127
136
# Inject context if user specifies.
128
- user_email = getattr (user , api_settings .PASSWORDLESS_USER_EMAIL_FIELD_NAME )
129
137
context = inject_template_context ({'callback_token' : email_token .key , 'user_email' :user_email , 'request' : kwargs ['request' ]})
130
138
html_message = loader .render_to_string (email_html , context ,)
131
139
send_mail (
132
140
email_subject ,
133
- email_plaintext % email_token . key ,
141
+ email_plaintext ,
134
142
api_settings .PASSWORDLESS_EMAIL_NOREPLY_ADDRESS ,
135
143
[user_email ],
136
144
fail_silently = False ,
0 commit comments