Skip to content

Commit

Permalink
fix(frontend): MiAuth認可画面で、認可処理に失敗した場合でもコールバックURLに遷移してしまう問題を修正 (#15154)
Browse files Browse the repository at this point in the history
* feat(MiAuth): アクセストークンの発行に失敗した場合コールバックに遷移しないようにする (MisskeyIO#831)

Cherry-picked from TeamNijimiss/misskey@8003596

Co-authored-by: nafu-at <satsuki@nafusoft.dev>

* Update Changelog

* Update Changelog

---------

Co-authored-by: あわわわとーにゅ <17376330+u1-liquid@users.noreply.github.com>
Co-authored-by: nafu-at <satsuki@nafusoft.dev>
  • Loading branch information
3 people authored Jan 4, 2025
1 parent 020882e commit 574034a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/803)
- Fix: 絵文字管理画面で一部の絵文字が表示されない問題を修正
- Fix: `Ui:C:select`で値の変更が画面に反映されない問題を修正
- Fix: MiAuth認可画面で、認可処理に失敗した場合でもコールバックURLに遷移してしまう問題を修正
(Cherry-picked from https://github.com/TeamNijimiss/misskey/commit/800359623e41a662551d774de15b0437b6849bb4)

### Server
- Fix: ユーザーのプロフィール画面をアドレス入力などで直接表示した際に概要タブの描画に失敗する問題の修正( #15032 )
Expand Down
20 changes: 10 additions & 10 deletions packages/frontend/src/pages/miauth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ async function onAccept(token: string) {
name: props.name,
iconUrl: props.icon,
permission: _permissions.value,
}, token).catch(() => {
}, token).then(() => {
if (props.callback && props.callback !== '') {
const cbUrl = new URL(props.callback);
if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:', 'vbscript:'].includes(cbUrl.protocol)) throw new Error('invalid url');
cbUrl.searchParams.set('session', props.session);
location.href = cbUrl.toString();
} else {
authRoot.value?.showUI('success');
}
}).catch(() => {
authRoot.value?.showUI('failed');
});

if (props.callback && props.callback !== '') {
const cbUrl = new URL(props.callback);
if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:', 'vbscript:'].includes(cbUrl.protocol)) throw new Error('invalid url');
cbUrl.searchParams.set('session', props.session);
location.href = cbUrl.toString();
} else {
authRoot.value?.showUI('success');
}
}

function onDeny() {
Expand Down

0 comments on commit 574034a

Please sign in to comment.