fix: magic link JWT (?token=) を先頭スクリプトで localStorage に保存
Made-with: Cursor
This commit is contained in:
parent
2a8bfb7306
commit
13c76e3a9f
|
|
@ -6,11 +6,18 @@
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
const p = new URLSearchParams(location.search);
|
const p = new URLSearchParams(location.search);
|
||||||
|
const tk = p.get('token');
|
||||||
|
if (tk) {
|
||||||
|
localStorage.setItem('posimai_token', tk);
|
||||||
|
p.delete('token');
|
||||||
|
}
|
||||||
const k = p.get('init_key');
|
const k = p.get('init_key');
|
||||||
if (k) {
|
if (k) {
|
||||||
localStorage.setItem('posimai-brief-apikey', k);
|
localStorage.setItem('posimai-brief-apikey', k);
|
||||||
p.delete('init_key');
|
p.delete('init_key');
|
||||||
const u = location.pathname + (p.toString() ? '?' + p : '');
|
}
|
||||||
|
if (tk || k) {
|
||||||
|
const u = location.pathname + (p.toString() ? '?' + p.toString() : '') + location.hash;
|
||||||
history.replaceState({}, '', u);
|
history.replaceState({}, '', u);
|
||||||
}
|
}
|
||||||
const t = localStorage.getItem('posimai-brief-theme') || 'system';
|
const t = localStorage.getItem('posimai-brief-theme') || 'system';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue