Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
孙永强 committed Aug 14, 2024
1 parent 513fcb4 commit 96b59b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions seahub/api2/endpoints/user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) 2012-2016 Seafile Ltd.
import logging
from datetime import datetime

from rest_framework import status
from rest_framework.authentication import SessionAuthentication
Expand All @@ -16,7 +17,7 @@
from seahub.organizations.settings import ORG_AUTO_URL_PREFIX
from seahub.organizations.views import gen_org_url_prefix
from seahub.password_session import update_session_auth_hash
from seahub.utils import is_valid_email
from seahub.utils import is_valid_email, send_html_email, get_site_name
from seahub.api2.authentication import TokenAuthentication
from seahub.api2.throttling import UserRateThrottle
from seahub.api2.utils import api_error
Expand Down Expand Up @@ -245,7 +246,15 @@ def post(self, request):

user.set_password(new_password)
user.save()

email_template_name = 'registration/password_change_email.html'
send_to = email2contact_email(request.user.username)
site_name = get_site_name()
c = {
'time': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
}
send_html_email(_("Successfully Changed Password on %s") % site_name,
email_template_name, c, None,
[send_to])
if not request.session.is_empty():
# update session auth hash
update_session_auth_hash(request, request.user)
Expand Down
2 changes: 1 addition & 1 deletion seahub/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def password_change(request, template_name='registration/password_change_form.ht
form = password_change_form(user=request.user, data=request.POST)
if form.is_valid():
form.save()

print('进入')
email_template_name = 'registration/password_change_email.html'
send_to = email2contact_email(request.user.username)
site_name = get_site_name()
Expand Down

0 comments on commit 96b59b7

Please sign in to comment.