mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
Ensure cookies are only ever set for admin
fixes #1901 - Adds a trailing slash to the cookie path - Resolves random log-outs - Adds a test which proves the case
This commit is contained in:
parent
51a741cadc
commit
3dea6431df
@ -234,8 +234,9 @@ module.exports = function (server, dbHash) {
|
||||
expressServer.use(express.urlencoded());
|
||||
|
||||
// ### Sessions
|
||||
// we need the trailing slash in the cookie path. Session handling *must* be after the slash handling
|
||||
cookie = {
|
||||
path: subdir + '/ghost',
|
||||
path: subdir + '/ghost/',
|
||||
maxAge: 12 * ONE_HOUR_MS
|
||||
};
|
||||
|
||||
|
@ -249,6 +249,17 @@ describe('Frontend Routing', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Post with Ghost in the url', function () {
|
||||
// All of Ghost's admin depends on the /ghost/ in the url to work properly
|
||||
// Badly formed regexs can cause breakage if a post slug starts with the 5 letters ghost
|
||||
it('should retrieve a blog post with ghost at the start of the url', function (done) {
|
||||
request.get('/ghostly-kitchen-sink/')
|
||||
.expect('Cache-Control', cacheRules['public'])
|
||||
.expect(200)
|
||||
.end(doEnd(done));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Static assets', function () {
|
||||
it('should retrieve shared assets', function (done) {
|
||||
request.get('/shared/img/usr-image.png')
|
||||
|
@ -10,8 +10,8 @@ DataGenerator.Content = {
|
||||
markdown: "<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\"#\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>"
|
||||
},
|
||||
{
|
||||
title: "Kitchen Sink",
|
||||
slug: "kitchen-sink",
|
||||
title: "Ghostly Kitchen Sink",
|
||||
slug: "ghostly-kitchen-sink",
|
||||
markdown: "<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\"#\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>"
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user