Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
frju365
Hiboo
Commits
91415c73
Commit
91415c73
authored
5 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Make the email resolution api more generic
parent
9cdb8861
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hiboo/api/views.py
+6
-9
6 additions, 9 deletions
hiboo/api/views.py
hiboo/configuration.py
+1
-1
1 addition, 1 deletion
hiboo/configuration.py
with
7 additions
and
10 deletions
hiboo/api/views.py
+
6
−
9
View file @
91415c73
...
...
@@ -4,16 +4,13 @@ from hiboo.api import blueprint
import
flask
@blueprint.route
(
"
/
mail/resolve/<
email
>
"
)
def
resolv
e_mail
(
email
):
@blueprint.route
(
"
/
profile/<profile_uuid>/
email
"
)
def
profil
e_
e
mail
(
profile_uuid
):
"""
This API endpoint behaves as a podop/postfis alias map
"""
flask
.
request
.
args
[
"
token
"
]
==
flask
.
current_app
.
config
[
"
PODOP_API_TOKEN
"
]
or
flask
.
abort
(
403
)
localpart
,
domain
=
email
.
split
(
"
@
"
,
1
)
if
domain
!=
flask
.
current_app
.
config
[
"
MAIL_DOMAIN
"
]:
flask
.
abort
(
404
)
user
=
models
.
User
.
query
.
filter_by
(
uuid
=
localpart
).
first
()
or
flask
.
abort
(
404
)
if
"
email
"
in
user
.
contact
:
return
flask
.
jsonify
(
user
.
contact
[
"
email
"
])
flask
.
request
.
args
[
"
token
"
]
==
flask
.
current_app
.
config
[
"
API_TOKEN
"
]
or
flask
.
abort
(
403
)
profile
=
models
.
Profile
.
query
.
get
(
profile_uuid
)
or
flask
.
abort
(
404
)
if
"
email
"
in
profile
.
user
.
contact
:
return
flask
.
jsonify
(
profile
.
user
.
contact
[
"
email
"
])
else
:
flask
.
abort
(
404
)
This diff is collapsed.
Click to expand it.
hiboo/configuration.py
+
1
−
1
View file @
91415c73
...
...
@@ -14,7 +14,7 @@ DEFAULT_CONFIG = {
'
TEMPLATES_AUTO_RELOAD
'
:
False
,
'
MAIL_DOMAIN
'
:
'
tedomum.net
'
,
'
WEBSITE_NAME
'
:
'
Hiboo
'
,
'
PODOP_
API_TOKEN
'
:
'
changeMe
'
'
API_TOKEN
'
:
'
changeMe
'
}
class
ConfigManager
(
dict
):
...
...
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