From 147961a9b9c2ebc45b018709c871919aa2ed63b8 Mon Sep 17 00:00:00 2001
From: Baoshuo
Date: Tue, 2 May 2023 18:28:59 +0800
Subject: [PATCH] feat(reset_pw): email notification
---
web/app/controllers/forgot_pw.php | 2 +-
web/app/controllers/reset_pw.php | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/web/app/controllers/forgot_pw.php b/web/app/controllers/forgot_pw.php
index 32cac41..a347f49 100644
--- a/web/app/controllers/forgot_pw.php
+++ b/web/app/controllers/forgot_pw.php
@@ -69,7 +69,7 @@ $forgot_form->handle = function (&$vdata) {
EOD, 5);
diff --git a/web/app/controllers/reset_pw.php b/web/app/controllers/reset_pw.php
index 10f185d..10abab2 100644
--- a/web/app/controllers/reset_pw.php
+++ b/web/app/controllers/reset_pw.php
@@ -32,6 +32,27 @@ function resetPassword() {
$newPW = $_POST['newPW'];
$newPW = getPasswordToStore($newPW, $user['username']);
+ $oj_name = UOJConfig::$data['profile']['oj-name'];
+ $oj_name_short = UOJConfig::$data['profile']['oj-name-short'];
+ $name = $user['username'];
+ $remote_addr = UOJContext::remoteAddr();
+ $http_x_forwarded_for = UOJContext::httpXForwardedFor();
+ $user_agent = UOJContext::httpUserAgent();
+
+ if ($user['realname']) {
+ $name .= ' (' . $user['realname'] . ')';
+ }
+
+ sendEmail($user['username'], "密码被重置", <<