Merge pull request #489 from rwese/fix-login-form-autofill

Fix login form password-manager support
This commit is contained in:
Jannis Mattheis 2022-05-29 20:05:12 +02:00 committed by GitHub
commit 0d18b421e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 17 additions and 18 deletions

View File

@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2
with:
version: v1.31
version: v1.45
args: --timeout=5m
- run: go mod download
- run: make download-tools

View File

@ -9,18 +9,15 @@ linters:
- deadcode
- depguard
- exportloopref
- gci
- godot
- gofmt
- gofumpt
- goimports
- golint
- gomodguard
- goprintffuncname
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- nolintlint

4
app.go
View File

@ -34,11 +34,11 @@ func main() {
conf := config.Get()
if conf.PluginsDir != "" {
if err := os.MkdirAll(conf.PluginsDir, 0755); err != nil {
if err := os.MkdirAll(conf.PluginsDir, 0o755); err != nil {
panic(err)
}
}
if err := os.MkdirAll(conf.UploadedImagesDir, 0755); err != nil {
if err := os.MkdirAll(conf.UploadedImagesDir, 0o755); err != nil {
panic(err)
}

View File

@ -1,3 +1,4 @@
//go:build !race
// +build !race
package auth

View File

@ -1,3 +1,4 @@
//go:build !race
// +build !race
package password

View File

@ -8,15 +8,9 @@ import (
"github.com/gotify/server/v2/auth/password"
"github.com/gotify/server/v2/model"
"github.com/jinzhu/gorm"
// enable the mysql dialect.
_ "github.com/jinzhu/gorm/dialects/mysql"
// enable the postgres dialect.
_ "github.com/jinzhu/gorm/dialects/postgres"
// enable the sqlite3 dialect.
_ "github.com/jinzhu/gorm/dialects/sqlite"
_ "github.com/jinzhu/gorm/dialects/mysql" // enable the mysql dialect.
_ "github.com/jinzhu/gorm/dialects/postgres" // enable the postgres dialect.
_ "github.com/jinzhu/gorm/dialects/sqlite" // enable the sqlite3 dialect.
)
var mkdirAll = os.MkdirAll
@ -95,7 +89,7 @@ func prepareBlobColumn(dialect string, db *gorm.DB) error {
func createDirectoryIfSqlite(dialect, connection string) {
if dialect == "sqlite3" {
if _, err := os.Stat(filepath.Dir(connection)); os.IsNotExist(err) {
if err := mkdirAll(filepath.Dir(connection), 0777); err != nil {
if err := mkdirAll(filepath.Dir(connection), 0o777); err != nil {
panic(err)
}
}

View File

@ -1,3 +1,4 @@
//go:build linux || darwin
// +build linux darwin
package compat

View File

@ -1,3 +1,4 @@
//go:build !race
// +build !race
package compat

View File

@ -1,3 +1,4 @@
//go:build (linux || darwin) && !race
// +build linux darwin
// +build !race

View File

@ -1,3 +1,4 @@
//go:build !race
// +build !race
package plugin

View File

@ -31,13 +31,13 @@ func TestWithWd(t *testing.T) {
WithWd("non_exist", func(string) {})
})
assert.Nil(t, os.Mkdir(tmpDir.Path(), 0644))
assert.Nil(t, os.Mkdir(tmpDir.Path(), 0o644))
assert.Panics(t, func() {
WithWd(tmpDir.Path(), func(string) {})
})
assert.Nil(t, os.Remove(tmpDir.Path()))
assert.Nil(t, os.Mkdir(tmpDir.Path(), 0755))
assert.Nil(t, os.Mkdir(tmpDir.Path(), 0o755))
assert.Panics(t, func() {
WithWd(tmpDir.Path(), func(string) {
assert.Nil(t, os.RemoveAll(tmpDir.Path()))

View File

@ -31,6 +31,7 @@ class Login extends Component<Stores<'currentUser'>> {
className="name"
label="Username"
margin="dense"
autoComplete="username"
value={username}
onChange={(e) => (this.username = e.target.value)}
/>
@ -39,6 +40,7 @@ class Login extends Component<Stores<'currentUser'>> {
className="password"
label="Password"
margin="normal"
autoComplete="current-password"
value={password}
onChange={(e) => (this.password = e.target.value)}
/>