Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
MCC APSIS
NACSOS
NACSOS Core
Commits
3cb84464
Commit
3cb84464
authored
1 year ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
add email handling
parent
cc848bda
No related branches found
No related tags found
1 merge request
!66
Master
Pipeline
#2302
failed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/api/routes/mailing.py
+21
-20
21 additions, 20 deletions
server/api/routes/mailing.py
with
21 additions
and
20 deletions
server/api/routes/mailing.py
+
21
−
20
View file @
3cb84464
...
...
@@ -62,32 +62,33 @@ async def reset_password(username: str) -> str:
@router.post
(
'
/welcome
'
,
response_class
=
PlainTextResponse
)
async
def
welcome_mail
(
username
:
str
,
password
:
str
,
superuser
:
UserModel
=
Depends
(
get_current_active_superuser
))
->
bool
:
superuser
:
UserModel
=
Depends
(
get_current_active_superuser
))
->
str
:
user
=
await
read_user_by_name
(
username
,
engine
=
db_engine
)
if
user
is
not
None
and
user
.
email
is
not
None
:
# Create new token
token
=
await
auth_helper
.
refresh_or_create_token
(
username
=
username
,
token_lifetime_minutes
=
3
*
60
)
return
await
send_message
(
recipients
=
[
user
.
email
],
subject
=
'
[NACSOS] Welcome to the platform
'
,
message
=
f
'
Dear
{
user
.
full_name
}
,
\n
'
f
'
I created an account on our scoping platform for you.
\n
'
f
'
\n
'
f
'
Username:
{
user
.
username
}
.
\n
'
f
'
Password:
{
password
}
\n
'
f
'
\n
'
f
'
You can change your password after logging in by opening the user menu at
'
f
'
the top right and clicking
"
edit profile
"
.
\n
'
f
'
\n
'
f
'
You can use the following link within the next 3h to reset your password:
\n
'
f
'
{
settings
.
SERVER
.
WEB_URL
}
/#/password-reset/
{
token
.
token_id
}
\n
'
f
'
\n
'
f
'
We are working on expanding the documentation for the platform here:
\n
'
f
'
https://apsis.mcc-berlin.net/nacsos-docs/
'
f
'
\n
'
f
'
Sincerely,
\n
'
f
'
The Platform
'
)
await
send_message
(
recipients
=
[
user
.
email
],
subject
=
'
[NACSOS] Welcome to the platform
'
,
message
=
f
'
Dear
{
user
.
full_name
}
,
\n
'
f
'
I created an account on our scoping platform for you.
\n
'
f
'
\n
'
f
'
Username:
{
user
.
username
}
.
\n
'
f
'
Password:
{
password
}
\n
'
f
'
\n
'
f
'
You can change your password after logging in by opening the user menu at
'
f
'
the top right and clicking
"
edit profile
"
.
\n
'
f
'
\n
'
f
'
You can use the following link within the next 3h to reset your password:
\n
'
f
'
{
settings
.
SERVER
.
WEB_URL
}
/#/password-reset/
{
token
.
token_id
}
\n
'
f
'
\n
'
f
'
We are working on expanding the documentation for the platform here:
\n
'
f
'
https://apsis.mcc-berlin.net/nacsos-docs/
\n
'
f
'
\n
'
f
'
Sincerely,
\n
'
f
'
The Platform
'
)
return
'
OK
'
@router.post
(
'
/assignment-reminder
'
,
response_model
=
list
[
str
])
...
...
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