web - add autocomplete off to password on login

concourse/concourse#3839

Signed-off-by: Jamie Klassen <cklassen@pivotal.io>
Co-authored-by: James Thomson <jthomson@pivotal.io>
This commit is contained in:
Jamie Klassen 2019-05-17 10:48:09 -04:00 committed by James Cooper
parent ca0a454620
commit b5aea536fe
2 changed files with 9 additions and 1 deletions

View File

@ -18,7 +18,7 @@
<div class="theme-form-label">
<label for="password">password</label>
</div>
<input tabindex="2" required id="password" name="password" type="password" class="theme-form-input" {{ if .Invalid }} autofocus {{ end }}/>
<input tabindex="2" required id="password" name="password" type="password" class="theme-form-input" autocomplete="off" {{ if .Invalid }} autofocus {{ end }}/>
</div>
{{ if .Invalid }}

View File

@ -58,3 +58,11 @@ test('can fly login with browser and reuse same browser without CSRF issues', as
await t.context.web.page.waitForSelector(pauseButton, {timeout: 90000});
t.pass();
});
test.only('password input does not autocomplete', async t => {
await t.context.web.page.goto(t.context.web.route('/sky/login'));
let passwordInput = await t.context.web.page.waitForSelector('#password', {timeout: 90000});
const autocomplete = await t.context.web.page.evaluate(body => body.getAttribute('autocomplete'), passwordInput);
await passwordInput.dispose();
t.is(autocomplete, 'off');
});