fix: disable password dialog on windows
This commit is contained in:
parent
4a3fb2be58
commit
26bdcd9a6a
1 changed files with 18 additions and 13 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"jws/internal/logger"
|
||||
"jws/internal/project"
|
||||
"log/slog"
|
||||
"runtime"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/data/binding"
|
||||
|
|
@ -33,19 +34,23 @@ func Init(window fyne.Window, deps []dependency.Dependency, projs []project.Proj
|
|||
|
||||
// ShowPasswordDialog shows a dialog to enter sudo password for installations
|
||||
func ShowPasswordDialog(index int) {
|
||||
password := binding.NewString()
|
||||
entry := widget.NewEntryWithData(password)
|
||||
entry.Password = true
|
||||
if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
|
||||
password := binding.NewString()
|
||||
entry := widget.NewEntryWithData(password)
|
||||
entry.Password = true
|
||||
|
||||
dialog.NewForm("Sudo Password", "ok", "cancel",
|
||||
[]*widget.FormItem{widget.NewFormItem("password", entry)},
|
||||
func(b bool) {
|
||||
pass, err := password.Get()
|
||||
if err == nil {
|
||||
if b {
|
||||
dependency.InstallDependency(index, pass, dependencies, mainWindow)
|
||||
dialog.NewForm("Sudo Password", "ok", "cancel",
|
||||
[]*widget.FormItem{widget.NewFormItem("password", entry)},
|
||||
func(b bool) {
|
||||
pass, err := password.Get()
|
||||
if err == nil {
|
||||
if b {
|
||||
dependency.InstallDependency(index, pass, dependencies, mainWindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mainWindow).Show()
|
||||
},
|
||||
mainWindow).Show()
|
||||
} else {
|
||||
dependency.InstallDependency(index, "", dependencies, mainWindow)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue