38 lines
834 B
Go
38 lines
834 B
Go
package props
|
|
|
|
import "github.com/Teajey/hmc"
|
|
|
|
type Login struct {
|
|
GeneralError string `json:",omitempty" xml:",omitempty"`
|
|
SuccessfulRegistration bool `json:",omitempty" xml:",omitempty"`
|
|
SuccessfulSetPassword bool `json:",omitempty" xml:",omitempty"`
|
|
Username hmc.Input
|
|
Password hmc.Input
|
|
}
|
|
|
|
func NewLogin(username, password string) Login {
|
|
return Login{
|
|
Username: hmc.Input{
|
|
Label: "Username",
|
|
Name: "username",
|
|
Required: true,
|
|
Value: username,
|
|
},
|
|
Password: hmc.Input{
|
|
Label: "Password",
|
|
Name: "password",
|
|
Type: "password",
|
|
Required: true,
|
|
Value: password,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (p *Login) Validate() (valid bool) {
|
|
_ = p.Username.Validate()
|
|
|
|
_ = p.Password.Validate()
|
|
|
|
return p.Username.Error == "" && p.Password.Error == ""
|
|
}
|