Skip to content

Commit

Permalink
Merge pull request #70 from team-shahu/enhance/login-notification
Browse files Browse the repository at this point in the history
Enhance/login notification
  • Loading branch information
chan-mai authored Feb 1, 2025
2 parents c83ae18 + 5df69e5 commit 75701ba
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
- ドライブから削除したファイルをオブジェクトストレージからも葬るように https://github.com/team-shahu/misskey/pull/49 https://github.com/team-shahu/misskey/pull/52
- えもえもローディング画面 https://github.com/team-shahu/misskey/pull/55
- セミパブリックモードの追加 https://github.com/team-shahu/misskey/pull/57 https://github.com/team-shahu/misskey/pull/60 https://github.com/team-shahu/misskey/pull/62 https://github.com/team-shahu/misskey/pull/63 https://github.com/team-shahu/misskey/pull/66 https://github.com/team-shahu/misskey/pull/68
- ログイン通知周りの改良 https://github.com/team-shahu/misskey/pull/59 https://github.com/team-shahu/misskey/pull/65
- ログイン通知周りの改良 https://github.com/team-shahu/misskey/pull/59 https://github.com/team-shahu/misskey/pull/65 https://github.com/team-shahu/misskey/pull/70
- 絵文字ライセンスをAPに追加 https://github.com/team-shahu/misskey/pull/64
- listenbrainzウィジェット https://github.com/team-shahu/misskey/pull/69
## Special Thanks
Expand Down
6 changes: 3 additions & 3 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9692,8 +9692,8 @@ export interface Locale extends ILocale {
*/
"login": string;
/**
* {ip}でログインされました
* 承認されていない機器であれば、セキュリティのために「{text}」を通じてすべての機器でログアウトを行ってください
* {ip}からログインされました
* 心当たりがない場合、設定の「{text}」からすべての機器をログアウトしてください
*/
"loginDescription": ParameterizedString<"ip" | "text">;
/**
Expand All @@ -9702,7 +9702,7 @@ export interface Locale extends ILocale {
"loginFailed": string;
/**
* {ip}からのログインに失敗しました。
* 自身のip以外でのログインが行われている場合、セキュリティのために設定にてパスワードを変更してください
* 心当たりがない場合はパスワードの変更を行ってください
*/
"loginFailedDescription": ParameterizedString<"ip">;
"_types": {
Expand Down
4 changes: 2 additions & 2 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2555,9 +2555,9 @@ _notification:
flushNotification: "通知の履歴をリセットする"
exportOfXCompleted: "{x}のエクスポートが完了しました"
login: "ログインがありました"
loginDescription: "{ip}でログインされました。\n承認されていない機器であれば、セキュリティのために「{text}」を通じてすべての機器でログアウトを行ってください"
loginDescription: "{ip}からログインされました。\n心当たりがない場合、設定の「{text}」からすべての機器をログアウトしてください"
loginFailed: "ログインに失敗しました"
loginFailedDescription: "{ip}からのログインに失敗しました。\n自身のip以外でのログインが行われている場合、セキュリティのために設定にてパスワードを変更してください"
loginFailedDescription: "{ip}からのログインに失敗しました。\n心当たりがない場合はパスワードの変更を行ってください"

_types:
all: "すべて"
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/server/api/SigninApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ export class SigninApiService {
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
if (profile.email && profile.emailVerified) {
this.emailService.sendEmail(profile.email, 'Login failed / ログインに失敗しました',
`userid: ${user.name ?? `@${user.username}`} <br>` +
`${user.name}(@${user.username}) <br>` +
`ip: ${request.ip} <br>` +
'header: ' + JSON.stringify(request.headers) + '<br>' +
'There is a new login. If you do not recognize this login, update the security status of your account, including changing your password. / 新しいログインがありました。このログインに心当たりがない場合は、パスワードを変更するなど、アカウントのセキュリティ状態を更新してください。',
`userid: ${user.name ?? `@${user.username}`} \n` +
`${user.name}(@${user.username}) \n` +
`ip: ${request.ip} \n` +
'header: ' + JSON.stringify(request.headers) + '\n' +
'There is a new login. If you do not recognize this login, update the security status of your account, including changing your password. / 新しいログインがありました。このログインに心当たりがない場合は、パスワードを変更するなど、アカウントのセキュリティ状態を更新してください。');
Expand Down
3 changes: 3 additions & 0 deletions packages/frontend/src/components/MkNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkA v-else-if="notification.type === 'loginFailed'" :class="$style.text" to="/settings/security">
<Mfm :text="i18n.tsx._notification.loginFailedDescription({ ip: notification.ip })"/>
</MkA>
<MkA v-else-if="notification.type === 'login'" :class="$style.text" to="/settings/security">

Check failure on line 130 in packages/frontend/src/components/MkNotification.vue

View workflow job for this annotation

GitHub Actions / lint (frontend)

This branch can never execute. Its condition is a duplicate or covered by previous conditions in the `v-if` / `v-else-if` chain
<Mfm :text="i18n.tsx._notification.loginDescription({ ip: notification.ip, text: i18n.ts.regenerateLoginToken })"/>
</MkA>
<template v-else-if="notification.type === 'follow'">
<span :class="$style.text" style="opacity: 0.6;">{{ i18n.ts.youGotNewFollower }}</span>
<div v-if="full"><MkFollowButton :user="notification.user" :full="true"/></div>
Expand Down

0 comments on commit 75701ba

Please sign in to comment.