Changeset b8ef4ab in OpenWorkouts-current
- Timestamp:
- Feb 19, 2019, 6:58:39 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 42d775c
- Parents:
- 07f5190
- Location:
- ow
- Files:
-
- 2 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ow/mail.py
r07f5190 rb8ef4ab 39 39 def send_verification_email(request, user): 40 40 subject = _('Welcome to OpenWorkouts') 41 template = 'ow:templates/mail_verify_account.pt' 41 txt_template = 'ow:templates/mail_verify_account_txt.pt' 42 html_template = 'ow:templates/mail_verify_account_html.pt' 42 43 verify_link = request.resource_url(user, 'verify', user.verification_token) 43 44 context = {'user': user, 'verify_link': verify_link} 44 45 mailer = get_mailer(request) 45 body = render(template, context, request) 46 message = Message(subject=subject, recipients=[user.email], body=body) 46 txt_body = render(txt_template, context, request) 47 html_body = render(html_template, context, request) 48 message = Message( 49 subject=subject, 50 recipients=[user.email], 51 body=txt_body, 52 html=html_body 53 ) 47 54 message = idna_encode_recipients(message) 48 55 mailer.send_to_queue(message) -
ow/static/css/main.css
r07f5190 rb8ef4ab 1486 1486 font-size: 0.8125rem; 1487 1487 } 1488 .verify-account-content { 1489 background-position: center; 1490 background-size: cover; 1491 display: flex; 1492 justify-content: center; 1493 align-items: center; 1494 min-height: calc(100vh - 98px); 1495 padding: 1em 0; 1496 color: #e1e1e1; 1497 } 1498 .verify-account-content .info { 1499 max-width: 580px; 1500 background-color: rgba(21, 21, 21, 0.6); 1501 border-radius: 6px; 1502 padding: 2em 1.5em; 1503 } 1504 .verify-account-content .info div { 1505 margin-bottom: 1.5em; 1506 } 1507 .verify-account-content a { 1508 color: #e1e1e1; 1509 font-size: 13px; 1510 text-decoration: none; 1511 margin-right: 0.75em; 1512 } 1513 .verify-account-content a:hover { 1514 color: white; 1515 } 1516 .verify-account-content .button { 1517 transition: all 500ms ease-in-out; 1518 background-color: #EE4056; 1519 color: white; 1520 text-transform: uppercase; 1521 } 1522 .verify-account-content .button:hover { 1523 background-color: #e6152f; 1524 } -
ow/static/less/main.less
r07f5190 rb8ef4ab 32 32 @import "pages/login.less"; 33 33 @import "pages/profile.less"; 34 @import "pages/verify_account.less"; -
ow/tests/test_mail.py
r07f5190 rb8ef4ab 41 41 message.recipients = ['user@example.net'] 42 42 m.return_value = message 43 body = Mock() 44 r.return_value = body 43 44 txt_body = Mock() 45 html_body = Mock() 46 r.side_effect = [txt_body, html_body] 47 45 48 request = DummyRequest() 46 49 request.root = root … … 49 52 verify_link = request.resource_url( 50 53 user, 'verify', user.verification_token) 51 r.assert_called_once_with( 52 'ow:templates/mail_verify_account.pt', 53 {'user': user, 'verify_link': verify_link}, 54 request 55 ) 54 55 # two render calls 56 assert r.call_count == 2 57 58 # first call renders the text version of the email 59 assert r.call_args_list[0][0][0] == ( 60 'ow:templates/mail_verify_account_txt.pt') 61 assert r.call_args_list[0][0][1] == ( 62 {'user': user, 'verify_link': verify_link}) 63 assert r.call_args_list[0][0][2] == request 64 65 # second call renders the html version of the email 66 assert r.call_args_list[1][0][0] == ( 67 'ow:templates/mail_verify_account_html.pt') 68 assert r.call_args_list[1][0][1] == ( 69 {'user': user, 'verify_link': verify_link}) 70 assert r.call_args_list[1][0][2] == request 71 56 72 m.assert_called_once 57 73 m.call_args_list[0][1]['recipients'] == user.email 58 m.call_args_list[0][1]['body'] == body 74 m.call_args_list[0][1]['body'] == txt_body 75 m.call_args_list[0][1]['html'] == html_body 59 76 mailer.send_to_queue.assert_called_once_with(message)
Note: See TracChangeset
for help on using the changeset viewer.