Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
78dcaf72
Commit
78dcaf72
authored
8 years ago
by
Arthur Ulfeldt
Browse files
Options
Downloads
Patches
Plain Diff
Comments to describe the reasons behind authentication guessing
parent
179ab17e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/email.clj
+3
-1
3 additions, 1 deletion
src/metabase/api/email.clj
src/metabase/email.clj
+11
-4
11 additions, 4 deletions
src/metabase/email.clj
with
14 additions
and
5 deletions
src/metabase/api/email.clj
+
3
−
1
View file @
78dcaf72
...
...
@@ -55,7 +55,9 @@
#
".*"
{
:message
"Sorry, something went wrong. Please try again."
}))))
(
defn
humanize-email-corrections
[
corrections
]
(
defn
humanize-email-corrections
"formats warnings when security settings are autocorrected"
[
corrections
]
(
into
{}
(
mapv
(
fn
[[
k
v
]]
[
k
(
format
"%s was autocorrected to %s"
...
...
This diff is collapsed.
Click to expand it.
src/metabase/email.clj
+
11
−
4
View file @
78dcaf72
...
...
@@ -88,6 +88,8 @@
:message
(
.getMessage
e
)})))
(
defn-
run-smtp-test
"tests an SMTP configuration by attempting to connect and authenticate
if an authenticated method is passed in :security."
[{
:keys
[
host
port
user
pass
sender
security
]
:as
details
}]
{
:pre
[(
string?
host
)
(
integer?
port
)]}
...
...
@@ -112,14 +114,19 @@
(
def
^
:private
email-security-order
[
"tls"
"starttls"
"ssl"
])
(
defn-
guess-smtp-security
[
details
]
(
loop
[[
security-type
&
more-to-try
]
email-security-order
]
(
when
security-type
(
defn-
guess-smtp-security
"Attempts to use each of the security methods in security order with the same set of credentials.
This is used only when the initial connection attempt fails, so it won't overwrite a functioning
configuration. If this uses something other than the provided method, a warning gets printed on
the config page"
[
details
]
(
loop
[[
security-type
&
more-to-try
]
email-security-order
]
;; make sure this is not lazy, or chunking
(
when
security-type
;; can cause some servers to block requests
(
let
[
test-result
(
run-smtp-test
(
assoc
details
:security
security-type
))]
(
if
(
not=
:ERROR
(
:error
test-result
))
(
assoc
test-result
:security
security-type
)
(
do
(
Thread/sleep
500
)
;; try not to get banned
(
Thread/sleep
500
)
;; try not to get banned
from outlook.com
(
recur
more-to-try
)))))))
(
defn
test-smtp-connection
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment