Revert: try to add storage access request during login, again

This commit is contained in:
igoradamenko
2018-11-12 21:28:14 +02:00
parent ad123aa3b3
commit 94687a9488
+26 -49
View File
@@ -117,58 +117,35 @@ export default class Root extends Component {
}
onSignIn(provider) {
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(e => {
// error obtaining storage access.
console.log('cant get storage access'); // eslint-disable-line no-console
console.error(e);
});
} else {
signIn();
}
const newWindow = window.open(
`${BASE_URL}/auth/${provider}/login?from=${encodeURIComponent(
location.origin + location.pathname + '?selfClose'
)}&site=${siteId}`,
'_blank',
'height=300,width=300'
);
function signIn() {
const newWindow = window.open(
`${BASE_URL}/auth/${provider}/login?from=${encodeURIComponent(
location.origin + location.pathname + '?selfClose'
)}&site=${siteId}`,
'_blank'
);
let secondsPass = 0;
const checkMsDelay = 300;
const checkInterval = setInterval(() => {
let shouldProceed;
secondsPass += checkMsDelay;
try {
shouldProceed = newWindow.closed || secondsPass > 30000;
} catch (e) {}
let secondsPass = 0;
const checkMsDelay = 300;
const checkInterval = setInterval(() => {
let shouldProceed;
secondsPass += checkMsDelay;
try {
shouldProceed = newWindow.closed || secondsPass > 30000;
} catch (e) {}
if (shouldProceed) {
clearInterval(checkInterval);
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);
}
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() {