mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-04-21 07:16:41 +02:00
feat(ui/migrations): clarify desired autocompletion type for clone_addr (#7377)
* Firefox thinks that this is a login form and that `clone_addr` is it's username field * It would have been an easy fix with with `autocomplete="off"`, but there's an issue with that approach: Firefox plays a cat-mouse game with web developers and intentionally ignores `autocomplete="off"` "for users' security". * Set it to the `url` autocompletion type, Firefox and maybe other browsers give actually somewhat relevant completion entries. They will not be always relevant, but they may be when a migration has to be re-done with different settings. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7377 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
parent
bb4e1f426f
commit
a23d0453a3
9 changed files with 13 additions and 11 deletions
|
@ -13,7 +13,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}
|
||||
</span>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{{template "base/alert" .}}
|
||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url">
|
||||
<span class="help">
|
||||
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
|
||||
</span>
|
||||
|
|
|
@ -79,10 +79,12 @@ func TestRepoMigrationUI(t *testing.T) {
|
|||
items := page.Find("#migrate_items .field .checkbox input")
|
||||
testRepoMigrationFormItems(t, items, migration.ExpectedItems)
|
||||
|
||||
descriptionInput := page.Find("#description")
|
||||
assert.Equal(t, 1, descriptionInput.Length())
|
||||
page.AssertElement(t, "#clone_addr", true)
|
||||
autocomplete, _ := page.Find("#clone_addr").Attr("autocomplete")
|
||||
assert.Equal(t, "url", autocomplete)
|
||||
|
||||
_, descriptionHasPlaceholder := descriptionInput.Attr("placeholder")
|
||||
page.AssertElement(t, "#description", true)
|
||||
_, descriptionHasPlaceholder := page.Find("#description").Attr("placeholder")
|
||||
assert.Equal(t, migration.DescriptionHasPlaceholder, descriptionHasPlaceholder)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue