Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Luca (strifel)
uffd
Commits
5300cd91
Verified
Commit
5300cd91
authored
4 years ago
by
nd
Browse files
Options
Downloads
Patches
Plain Diff
do not fail if mail could not be sent, closes #9
parent
87882cc2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
uffd/selfservice/templates/set_password.html
+1
-1
1 addition, 1 deletion
uffd/selfservice/templates/set_password.html
uffd/selfservice/views.py
+15
-10
15 additions, 10 deletions
uffd/selfservice/views.py
with
16 additions
and
11 deletions
uffd/selfservice/templates/set_password.html
+
1
−
1
View file @
5300cd91
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<label
for=
"user-password1"
>
New Password
</label>
<label
for=
"user-password1"
>
New Password
</label>
<input
type=
"password"
class=
"form-control"
id=
"user-password1"
name=
"password1"
required=
"required"
tabindex =
"2"
>
<input
type=
"password"
class=
"form-control"
id=
"user-password1"
name=
"password1"
required=
"required"
tabindex =
"2"
>
<small
class=
"form-text text-muted"
>
<small
class=
"form-text text-muted"
>
At least 8 characters, no other special requirements. But please don't be stupid and use a password manager.
At least 8
and at most 256
characters, no other special requirements. But please don't be stupid and use a password manager.
</small>
</small>
</div>
</div>
<div
class=
"form-group col-12"
>
<div
class=
"form-group col-12"
>
...
...
This diff is collapsed.
Click to expand it.
uffd/selfservice/views.py
+
15
−
10
View file @
5300cd91
...
@@ -145,13 +145,18 @@ def send_passwordreset(loginname):
...
@@ -145,13 +145,18 @@ def send_passwordreset(loginname):
send_mail
(
user
.
mail
,
msg
)
send_mail
(
user
.
mail
,
msg
)
def
send_mail
(
to_address
,
msg
):
def
send_mail
(
to_address
,
msg
):
server
=
smtplib
.
SMTP
(
host
=
current_app
.
config
[
'
MAIL_SERVER
'
],
port
=
current_app
.
config
[
'
MAIL_PORT
'
])
try
:
if
current_app
.
config
[
'
MAIL_USE_STARTTLS
'
]:
server
=
smtplib
.
SMTP
(
host
=
current_app
.
config
[
'
MAIL_SERVER
'
],
port
=
current_app
.
config
[
'
MAIL_PORT
'
])
server
.
starttls
()
if
current_app
.
config
[
'
MAIL_USE_STARTTLS
'
]:
server
.
login
(
current_app
.
config
[
'
MAIL_USERNAME
'
],
current_app
.
config
[
'
MAIL_PASSWORD
'
])
server
.
starttls
()
msg
[
'
From
'
]
=
current_app
.
config
[
'
MAIL_FROM_ADDRESS
'
]
server
.
login
(
current_app
.
config
[
'
MAIL_USERNAME
'
],
current_app
.
config
[
'
MAIL_PASSWORD
'
])
msg
[
'
To
'
]
=
to_address
msg
[
'
From
'
]
=
current_app
.
config
[
'
MAIL_FROM_ADDRESS
'
]
msg
[
'
Date
'
]
=
email
.
utils
.
formatdate
(
localtime
=
1
)
msg
[
'
To
'
]
=
to_address
msg
[
'
Message-ID
'
]
=
email
.
utils
.
make_msgid
()
msg
[
'
Date
'
]
=
email
.
utils
.
formatdate
(
localtime
=
1
)
server
.
send_message
(
msg
)
msg
[
'
Message-ID
'
]
=
email
.
utils
.
make_msgid
()
server
.
quit
()
server
.
send_message
(
msg
)
server
.
quit
()
return
True
except
SMTPException
:
flash
(
'
Mail to
"
{}
"
could not be sent!
'
.
format
(
to_address
))
return
False
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