Basic GUI client, login dialog, various comments fixes after copypaste.
Some checks failed
Linting and tests / Linting (push) Failing after 6s
Some checks failed
Linting and tests / Linting (push) Failing after 6s
This commit is contained in:
53
client/internal/services/features/accounts/login_dialog.go
Normal file
53
client/internal/services/features/accounts/login_dialog.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package accounts
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func (a *accounts) loginDialogLogin() {
|
||||
a.logger.Info(
|
||||
"Trying to log in...",
|
||||
"instance", a.loginDialogInstanceAddressEntry.Text,
|
||||
"username", a.loginDialogUsernameEntry.Text,
|
||||
"password", a.loginDialogPasswordEntry.Text,
|
||||
)
|
||||
}
|
||||
|
||||
func (a *accounts) loginDialogShow() {
|
||||
if a.loginDialogInstanceAddressEntry == nil {
|
||||
a.loginDialogInstanceAddressEntry = widget.NewEntry()
|
||||
a.loginDialogInstanceAddressEntry.SetText("http://localhost:53400")
|
||||
}
|
||||
|
||||
if a.loginDialogUsernameEntry == nil {
|
||||
a.loginDialogUsernameEntry = widget.NewEntry()
|
||||
a.loginDialogUsernameEntry.SetPlaceHolder("username")
|
||||
}
|
||||
|
||||
if a.loginDialogPasswordEntry == nil {
|
||||
a.loginDialogPasswordEntry = widget.NewEntry()
|
||||
} else {
|
||||
a.loginDialogPasswordEntry.SetText("")
|
||||
}
|
||||
|
||||
loginForm := widget.NewForm(
|
||||
widget.NewFormItem("Instance address:", a.loginDialogInstanceAddressEntry),
|
||||
widget.NewFormItem("Login:", a.loginDialogUsernameEntry),
|
||||
widget.NewFormItem("Password:", a.loginDialogPasswordEntry),
|
||||
)
|
||||
|
||||
loginButton := widget.NewButton("Log in", a.loginDialogLogin)
|
||||
|
||||
loginDialogContent := container.NewBorder(nil, loginButton, nil, nil, loginForm)
|
||||
|
||||
dialog := dialog.NewCustomWithoutButtons(
|
||||
"Login to Bunker instance",
|
||||
loginDialogContent,
|
||||
a.mainWindow.MainWindow(),
|
||||
)
|
||||
dialog.Resize(dialog.MinSize().AddWidthHeight(200, 0))
|
||||
|
||||
dialog.Show()
|
||||
}
|
Reference in New Issue
Block a user