wip
Some checks failed
CloudSave/pipeline/head There was a failure building this commit

This commit is contained in:
2025-09-08 01:21:53 +02:00
parent 7e5d8855d4
commit f56d3c5857
4 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
package credential
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
)
type (
CredentialDialog struct {
*dialog.FormDialog
inputUsername *widget.Entry
inputPassword *widget.Entry
}
)
func Make(remoteHostname string, callback func(v bool), w fyne.Window) *CredentialDialog {
label := canvas.NewText("Connexion to "+remoteHostname, color.Black)
inputUsername := widget.NewEntry()
inputUsername.SetPlaceHolder("Username")
inputPassword := widget.NewEntry()
inputPassword.Password = true
inputPassword.SetPlaceHolder("Password")
formItems := []*widget.FormItem{
{
Text: "",
Widget: label,
},
{
Text: "Username",
Widget: inputUsername,
},
{
Text: "Password",
Widget: inputPassword,
},
}
d := &CredentialDialog{
FormDialog: dialog.NewForm("Syncing", "Connexion", "Cancel", formItems, callback, w),
inputUsername: inputUsername,
inputPassword: inputPassword,
}
return d
}
func (c *CredentialDialog) Credentials() (string, string) {
return c.inputUsername.Text, c.inputPassword.Text
}