Skip to content

Commit

Permalink
feat(MiAuth): アクセストークンの発行に失敗した場合コールバックに遷移しないようにする (#831)
Browse files Browse the repository at this point in the history
Cherry-picked from TeamNijimiss/misskey@8003596

Co-authored-by: nafu-at <[email protected]>
  • Loading branch information
u1-liquid and nafu-at authored Dec 17, 2024
1 parent 714aad6 commit 7772d42
Showing 1 changed file with 10 additions and 10 deletions.
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 7772d42

Please sign in to comment.