Load a saved story into the form for editors only.
Visitors could post an id to /publish and read the author's email address.
This commit is contained in:
@@ -97,6 +97,17 @@ class SubmitTest extends PageTestCase {
|
||||
$this->assertSame(array('original author', 0, ''), array($tables['queue'][0]['editor'], $tables['queue'][0]['hidden'], $tables['queue'][0]['comments']));
|
||||
}
|
||||
|
||||
public function testVisitorsCannotLoadAStoryIntoTheForm(): void {
|
||||
$this->setTables(array('xxx' => array(array('id' => 7, 'title' => 'Live one', 'email' => 'author@example.org'))));
|
||||
$token = $this->csrfToken($this->get('/publish')['body']);
|
||||
foreach (array('edit', 'choose', 'other') as $action) {
|
||||
$page = $this->post('/publish', array('action' => $action, 'id' => '7', 'csrf_token' => $token));
|
||||
$this->assertStringNotContainsString('author@example.org', $page['body']);
|
||||
$this->assertStringNotContainsString('Live one', $page['body']);
|
||||
}
|
||||
$this->assertSame(array(), $this->queries('/^SELECT \* FROM xxx/'));
|
||||
}
|
||||
|
||||
public function testAPostWithoutTheTokenOnlyGetsAPreview(): void {
|
||||
$this->get('/publish');
|
||||
$page = $this->post('/publish', $this->story(array('action' => 'submit', 'csrf_token' => 'wrong', 'g-recaptcha-response' => 'pass')));
|
||||
|
||||
Reference in New Issue
Block a user