mirror of
https://github.com/tloncorp/landscape.git
synced 2024-12-01 02:45:49 +03:00
Merge pull request #83 from tloncorp/hm/fix-auth
auth: switch to new compatibility method
This commit is contained in:
commit
8a390c52a7
@ -1,3 +1,4 @@
|
||||
import { preSig } from '@urbit/api';
|
||||
import cookies from 'browser-cookies';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
@ -20,7 +21,16 @@ function checkIfLoggedIn() {
|
||||
|
||||
const session = cookies.get(`urbauth-~${window.ship}`);
|
||||
if (!session) {
|
||||
authRedirect();
|
||||
fetch('/~/name')
|
||||
.then((res) => res.text())
|
||||
.then((name) => {
|
||||
if (name !== preSig(window.ship)) {
|
||||
authRedirect();
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
authRedirect();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user