try to add storage access request during login, again
This commit is contained in:
@@ -117,33 +117,56 @@ export default class Root extends Component {
|
||||
}
|
||||
|
||||
onSignIn(provider) {
|
||||
const newWindow = window.open(
|
||||
`${BASE_URL}/auth/${provider}/login?from=${encodeURIComponent(
|
||||
location.origin + location.pathname + '?selfClose'
|
||||
)}&site=${siteId}`
|
||||
);
|
||||
if (document.hasStorageAccess) {
|
||||
document
|
||||
.hasStorageAccess()
|
||||
.then(hasAccess => {
|
||||
if (!hasAccess) {
|
||||
return document.requestStorageAccess();
|
||||
}
|
||||
console.log('already has storage access'); // eslint-disable-line no-console
|
||||
})
|
||||
.then(() => {
|
||||
// Now we have first-party storage access!
|
||||
signIn();
|
||||
})
|
||||
.catch(() => {
|
||||
// error obtaining storage access.
|
||||
console.log('cant get storage access'); // eslint-disable-line no-console
|
||||
});
|
||||
} else {
|
||||
signIn();
|
||||
}
|
||||
|
||||
let secondsPass = 0;
|
||||
const checkMsDelay = 300;
|
||||
const checkInterval = setInterval(() => {
|
||||
let shouldProceed;
|
||||
secondsPass += checkMsDelay;
|
||||
try {
|
||||
shouldProceed = newWindow.closed || secondsPass > 30000;
|
||||
} catch (e) {}
|
||||
function signIn() {
|
||||
const newWindow = window.open(
|
||||
`${BASE_URL}/auth/${provider}/login?from=${encodeURIComponent(
|
||||
location.origin + location.pathname + '?selfClose'
|
||||
)}&site=${siteId}`
|
||||
);
|
||||
|
||||
if (shouldProceed) {
|
||||
clearInterval(checkInterval);
|
||||
let secondsPass = 0;
|
||||
const checkMsDelay = 300;
|
||||
const checkInterval = setInterval(() => {
|
||||
let shouldProceed;
|
||||
secondsPass += checkMsDelay;
|
||||
try {
|
||||
shouldProceed = newWindow.closed || secondsPass > 30000;
|
||||
} catch (e) {}
|
||||
|
||||
api
|
||||
.getUser()
|
||||
.then(user => {
|
||||
store.set('user', user);
|
||||
this.setState({ user });
|
||||
})
|
||||
.catch(() => {}); // TODO: we need to handle it and write error to user
|
||||
}
|
||||
}, checkMsDelay);
|
||||
if (shouldProceed) {
|
||||
clearInterval(checkInterval);
|
||||
|
||||
api
|
||||
.getUser()
|
||||
.then(user => {
|
||||
store.set('user', user);
|
||||
this.setState({ user });
|
||||
})
|
||||
.catch(() => {}); // TODO: we need to handle it and write error to user
|
||||
}
|
||||
}, checkMsDelay);
|
||||
}
|
||||
}
|
||||
|
||||
onBlockedUsersShow() {
|
||||
|
||||
Generated
+2997
-2997
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user