Skip to content
This repository was archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
Use a function to create the ExtendedEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 10, 2020
1 parent ec9132d commit 37fa395
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ func (e *ExtendedEntry) TypedKey(ev *fyne.KeyEvent) {
}
}

// NewExtendedEntry creates an ExtendedEntry button.
func NewExtendedEntry(password bool) *ExtendedEntry {
entry := &ExtendedEntry{}

// Extend the base widget.
entry.ExtendBaseWidget(entry)

// Check if we are creating a password entry.
if password {
entry.Password = true
}

return entry
}

// PasswordKey contains the key taken from the username and password.
var PasswordKey [32]byte

Expand All @@ -49,15 +64,12 @@ func Init() {
window := app.NewWindow("Sparta")

// Initialize the login form that we are to be using.
userName := &ExtendedEntry{}
userName.ExtendBaseWidget(userName)
userName := NewExtendedEntry(false)
userName.SetPlaceHolder("Username")

// Initialize the password input box that we are to be using.
userPassword := &ExtendedEntry{}
userPassword.ExtendBaseWidget(userPassword)
userPassword := NewExtendedEntry(true)
userPassword.SetPlaceHolder("Password")
userPassword.Password = true

// Create the login button that will calculate the 32bit long sha256 hash.
loginButton := widget.NewButton("Login", func() {
Expand Down

0 comments on commit 37fa395

Please sign in to comment.