Merge pull request #9383 from vector-im/travis/expire-mobile-page

Add expiration to mobile guide cookie
pull/9392/head
Travis Ralston 2019-04-04 12:00:10 -06:00 committed by GitHub
commit 2aeaa081fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -272,7 +272,7 @@ async function loadApp() {
const isIos = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; const isIos = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
const isAndroid = /Android/.test(navigator.userAgent); const isAndroid = /Android/.test(navigator.userAgent);
if (isIos || isAndroid) { if (isIos || isAndroid) {
if (!document.cookie.split(';').some((c) => c.startsWith('mobile_redirect_to_guide'))) { if (document.cookie.indexOf("riot_mobile_redirect_to_guide=false") === -1) {
window.location = "mobile_guide/"; window.location = "mobile_guide/";
return; return;
} }

View File

@ -1,7 +1,8 @@
import {getVectorConfig} from '../getconfig'; import {getVectorConfig} from '../getconfig';
function onBackToRiotClick() { function onBackToRiotClick() {
document.cookie = 'mobile_redirect_to_guide=false;path=/'; // Cookie should expire in 4 hours
document.cookie = 'riot_mobile_redirect_to_guide=false;path=/;max-age=14400';
window.location.href = '../'; window.location.href = '../';
} }