Skip to content

Commit

Permalink
Fix email configuration issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rouja committed Feb 22, 2024
1 parent b1592ad commit 659672a
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 19 deletions.
2 changes: 2 additions & 0 deletions apiserver/plane/bgtasks/analytic_plot_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def send_export_email(email, slug, csv_buffer, rows):
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

Expand All @@ -66,6 +67,7 @@ def send_export_email(email, slug, csv_buffer, rows):
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
20 changes: 11 additions & 9 deletions apiserver/plane/bgtasks/email_notification_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,16 @@ def send_email_notification(
base_api = (ri.get(str(issue_id)).decode())
data = create_payload(notification_data=notification_data)

# Get email configurations
(
EMAIL_HOST,
EMAIL_HOST_USER,
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_FROM,
) = get_email_configuration()
# Get email configurations
(
EMAIL_HOST,
EMAIL_HOST_USER,
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

receiver = User.objects.get(pk=receiver_id)
issue = Issue.objects.get(pk=issue_id)
Expand Down Expand Up @@ -273,6 +274,7 @@ def send_email_notification(
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/bgtasks/forgot_password_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def forgot_password(first_name, email, uidb64, token, current_site):
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

Expand All @@ -54,6 +55,7 @@ def forgot_password(first_name, email, uidb64, token, current_site):
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/bgtasks/magic_link_code_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def magic_link(email, key, token, current_site):
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

Expand All @@ -44,6 +45,7 @@ def magic_link(email, key, token, current_site):
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/bgtasks/project_invitation_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def project_invitation(email, project_id, token, current_site, invitor):
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

Expand All @@ -62,6 +63,7 @@ def project_invitation(email, project_id, token, current_site, invitor):
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/bgtasks/webhook_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def send_webhook_deactivation_email(webhook_id, receiver_id, current_site, reaso
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

Expand All @@ -278,6 +279,7 @@ def send_webhook_deactivation_email(webhook_id, receiver_id, current_site, reaso
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/bgtasks/workspace_invitation_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def workspace_invitation(email, workspace_id, token, current_site, invitor):
EMAIL_HOST_PASSWORD,
EMAIL_PORT,
EMAIL_USE_TLS,
EMAIL_USE_SSL,
EMAIL_FROM,
) = get_email_configuration()

Expand Down Expand Up @@ -70,6 +71,7 @@ def workspace_invitation(email, workspace_id, token, current_site, invitor):
username=EMAIL_HOST_USER,
password=EMAIL_HOST_PASSWORD,
use_tls=EMAIL_USE_TLS == "1",
use_ssl=EMAIL_USE_SSL == "1",
)

msg = EmailMultiAlternatives(
Expand Down
4 changes: 4 additions & 0 deletions apiserver/plane/license/utils/instance_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def get_email_configuration():
"key": "EMAIL_USE_TLS",
"default": os.environ.get("EMAIL_USE_TLS", "1"),
},
{
"key": "EMAIL_USE_SSL",
"default": os.environ.get("EMAIL_USE_SSL", "0"),
},
{
"key": "EMAIL_FROM",
"default": os.environ.get(
Expand Down
8 changes: 4 additions & 4 deletions web/components/instance/email-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface EmailFormValues {
EMAIL_HOST_USER: string;
EMAIL_HOST_PASSWORD: string;
EMAIL_USE_TLS: string;
// EMAIL_USE_SSL: string;
EMAIL_USE_SSL: string;
EMAIL_FROM: string;
}

Expand All @@ -44,7 +44,7 @@ export const InstanceEmailForm: FC<IInstanceEmailForm> = (props) => {
EMAIL_HOST_USER: config["EMAIL_HOST_USER"],
EMAIL_HOST_PASSWORD: config["EMAIL_HOST_PASSWORD"],
EMAIL_USE_TLS: config["EMAIL_USE_TLS"],
// EMAIL_USE_SSL: config["EMAIL_USE_SSL"],
EMAIL_USE_SSL: config["EMAIL_USE_SSL"],
EMAIL_FROM: config["EMAIL_FROM"],
},
});
Expand Down Expand Up @@ -221,7 +221,7 @@ export const InstanceEmailForm: FC<IInstanceEmailForm> = (props) => {
</div>
</div>

{/* <div className="flex items-center gap-10 pt-4 mr-8">
<div className="flex items-center gap-10 pt-4 mr-8">
<div className="grow">
<div className="text-custom-text-100 font-medium text-sm">
Turn SSL {Boolean(parseInt(watch("EMAIL_USE_SSL"))) ? "off" : "on"}
Expand All @@ -245,7 +245,7 @@ export const InstanceEmailForm: FC<IInstanceEmailForm> = (props) => {
)}
/>
</div>
</div> */}
</div>
</div>

<div className="flex max-w-4xl items-center py-1">
Expand Down
11 changes: 5 additions & 6 deletions web/pages/god-mode/authorization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ const InstanceAdminAuthorizationPage: NextPageWithLayout = observer(() => {
<div className={`shrink-0 ${isSubmitting && "opacity-70"}`}>
<ToggleSwitch
value={Boolean(parseInt(enableMagicLogin))}
// onChange={() => {
// Boolean(parseInt(enableMagicLogin)) === true
// ? updateConfig("ENABLE_MAGIC_LINK_LOGIN", "0")
// : updateConfig("ENABLE_MAGIC_LINK_LOGIN", "1");
// }}
onChange={() => {}}
onChange={() => {
Boolean(parseInt(enableMagicLogin)) === true
? updateConfig("ENABLE_MAGIC_LINK_LOGIN", "0")
: updateConfig("ENABLE_MAGIC_LINK_LOGIN", "1");
}}
size="sm"
disabled={isSubmitting}
/>
Expand Down

0 comments on commit 659672a

Please sign in to comment.