Skip to content

Commit d67f3d1

Browse files
lizhemingCopilot
andauthored
chore: remove useless field mailMd5 (#3362)
* chore: remove mailMd5 field * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8031e49 commit d67f3d1

5 files changed

Lines changed: 7 additions & 19 deletions

File tree

packages/admin/src/pages/profile/index.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ export default function () {
110110
rel="noreferrer"
111111
onClick={changeAvatar}
112112
>
113-
<img
114-
className="profile-avatar"
115-
src={
116-
user.avatar ||
117-
`https://seccdn.libravatar.org/avatar/${user.mailMd5}?s=220&amp;r=X&amp;d=mm`
118-
}
119-
/>
113+
{user && user.avatar && (
114+
<img
115+
className="profile-avatar"
116+
src={user.avatar}
117+
alt={t('avatar')}
118+
/>
119+
)}
120120
</a>
121121
</p>
122122
<h2>{user.display_name}</h2>

packages/api/src/login.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ export interface UserInfo {
3838
*/
3939
avatar: string;
4040

41-
/**
42-
* 用户邮箱 MD5
43-
*
44-
* MD5 of User email
45-
*/
46-
mailMd5: string;
47-
4841
/**
4942
* 用户对象 ID
5043
*

packages/server/src/controller/token.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const jwt = require('jsonwebtoken');
22
const speakeasy = require('speakeasy');
3-
const helper = require('think-helper');
43

54
const BaseRest = require('./rest.js');
65

@@ -60,7 +59,6 @@ module.exports = class extends BaseRest {
6059
return this.success({
6160
...user[0],
6261
password: null,
63-
mailMd5: helper.md5(user[0].email.toLowerCase()),
6462
token: jwt.sign(user[0].email, this.config('jwtKey')),
6563
});
6664
}

packages/server/src/logic/base.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const path = require('node:path');
22
const qs = require('node:querystring');
33

44
const jwt = require('jsonwebtoken');
5-
const helper = require('think-helper');
65

76
module.exports = class extends think.Logic {
87
constructor(...args) {
@@ -141,7 +140,6 @@ module.exports = class extends think.Logic {
141140
avatarUrl = avatarProxy + '?url=' + encodeURIComponent(avatarUrl);
142141
}
143142
userInfo.avatar = avatarUrl;
144-
userInfo.mailMd5 = helper.md5(userInfo.email);
145143
this.ctx.state.userInfo = userInfo;
146144
this.ctx.state.token = token;
147145
}

packages/server/src/logic/token.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module.exports = class extends Base {
1616
* @apiSuccess (200) {String} data.display_name user nick name
1717
* @apiSuccess (200) {String} data.email user email address
1818
* @apiSuccess (200) {String} data.github user github account name
19-
* @apiSuccess (200) {String} data.mailMd5 user mail md5
2019
* @apiSuccess (200) {String} data.objectId user id
2120
* @apiSuccess (200) {String} data.type user type, administrator or guest
2221
* @apiSuccess (200) {String} data.url user link

0 commit comments

Comments
 (0)