Show warning if email server isn't configured

This commit is contained in:
Arik Fraimovich
2016-03-15 10:37:33 +02:00
parent 7a943f62b3
commit 0dccaa9ca4
8 changed files with 16 additions and 59 deletions

View File

@@ -107,6 +107,17 @@
}
}]);
directives.directive('emailSettingsWarning', function() {
return {
restrict: 'E',
template: '<p class="alert alert-warning" ng-if="showMailWarning">It looks like your mail server isn\'t configured, make sure to configure it for the {{function}} to work.</p>',
link: function(scope, elements, attrs) {
scope.showMailWarning = clientConfig.mailSettingsMissing && currentUser.isAdmin;
scope.function = attrs.function;
}
}
});
directives.directive('rdTabs', ['$location', function ($location) {
return {
restrict: 'E',

View File

@@ -1,4 +1,5 @@
<div class="container">
<email-settings-warning function="alert emails"></email-settings-warning>
<ol class="breadcrumb">
<li><a href="alerts">Alerts</a></li>
<li class="active">{{alert.name || getDefaultName() || "New"}}</li>

View File

@@ -1,4 +1,5 @@
<div class="container">
<email-settings-warning function="invite emails"></email-settings-warning>
<users-nav></users-nav>
<form class="form" name="userForm" ng-submit="saveUser()" novalidate>

View File

@@ -1,4 +1,6 @@
<div class="container">
<email-settings-warning function="invite emails"></email-settings-warning>
<users-nav></users-nav>
<h2>{{user.name}}</h2>

View File

@@ -44,20 +44,6 @@ def send_invite_email(inviter, invited, invite_url, org):
send_mail.delay([invited.email], subject, html_content, text_content)
def send_reminder_email(email):
users = list(User.find_by_email(email))
if users:
context = dict(users=users, email=email)
html_content = render_template('emails/reminder.html', **context)
text_content = render_template('emails/reminder.txt', **context)
subject = u"Your Re:dash Account Reminder"
send_mail.delay([email], subject, html_content, text_content)
else:
logger.error("Reminder email - failed to find users for: %s", email)
def send_password_reset_email(user):
reset_link = reset_link_for_user(user)
context = dict(user=user, reset_link=reset_link)

View File

@@ -174,4 +174,5 @@ COMMON_CLIENT_CONFIG = {
'dateFormat': DATE_FORMAT,
'dateTimeFormat': "{0} HH:mm".format(DATE_FORMAT),
'allowAllToEditQueries': FEATURE_ALLOW_ALL_TO_EDIT_QUERIES,
'mailSettingsMissing': MAIL_DEFAULT_SENDER is None
}

View File

@@ -1,28 +0,0 @@
{% extends "emails/layout.html" %}
{% block content %}
<p class="intercom-align-left" style="line-height: 1.5; margin: 0 0 17px; text-align: left !important" align="left">Hi there,</p>
<p class="intercom-align-left" style="line-height: 1.5; margin: 0 0 17px; text-align: left !important" align="left">
We searched for Re:dash accounts you've already joined or are allowed to join, using {{email}} and we found the following:
</p>
<p class="intercom-align-left" style="line-height: 1.5; margin: 0 0 17px; text-align: left !important" align="left">
<ul>
{% for account in users %}
<li>{{account.org.name}}: <a href="{{ url_for('redash.index', org_slug=account.org.slug, _external=True) }}">{{ url_for('redash.index', org_slug=account.org.slug, _external=True) }}</a></li>
{% endfor %}
</ul>
</p>
<p class="intercom-align-left" style="line-height: 1.5; margin: 0 0 17px; text-align: left !important" align="left">
If you're trying to join a specific account that isn't listed here, you can try contacting your account administrator for an invitation.
You can also try a different email, or forge ahead and <a href="{{ url_for('redash.signup', _external=True)}}">create a new account</a>!
</p>
<p class="intercom-align-left" style="line-height: 1.5; margin: 0 0 17px; text-align: left !important" align="left">
Please let us know if you have any other questions or feedback.
</p>
<p class="intercom-align-left" style="line-height: 1.5; margin: 0 0 17px; text-align: left !important" align="left">
Cheers,<br/>
Re:dash
</p>
{% endblock %}

View File

@@ -1,17 +0,0 @@
Hi there,
We searched for Re:dash accounts you've already joined or are allowed to join, using {{email}} and we found the following:
{% for account in users %}
* {{account.org.name}}: {{ url_for('redash.index', org_slug=account.org.slug, _external=True) }}
{% endfor %}
If you're trying to join a specific account that isn't listed here, you can try contacting your team administrator for an invitation.
You can also try a different email, or forge ahead and create a new team!
Please let us know if you have any other questions or feedback.
Cheers,
Re:dash