Skip to content

Commit

Permalink
Merge pull request #9383 from vector-im/travis/expire-mobile-page
Browse files Browse the repository at this point in the history
Add expiration to mobile guide cookie
  • Loading branch information
turt2live committed Apr 4, 2019
2 parents 50b4906 + b72ae19 commit 2aeaa08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vector/index.js
Expand Up @@ -272,7 +272,7 @@ async function loadApp() {
const isIos = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
const isAndroid = /Android/.test(navigator.userAgent);
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/";
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/vector/mobile_guide/index.js
@@ -1,7 +1,8 @@
import {getVectorConfig} from '../getconfig';

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 = '../';
}

Expand Down

0 comments on commit 2aeaa08

Please sign in to comment.