27 lines
483 B
Go
27 lines
483 B
Go
package auth
|
|
|
|
import "time"
|
|
|
|
const (
|
|
ConfigFileName = "auth.json"
|
|
)
|
|
|
|
type StateType int
|
|
|
|
const (
|
|
StateTypeNotRegisterd StateType = iota
|
|
StateTypeRegisterd
|
|
)
|
|
|
|
type Auth struct {
|
|
TempKey *string `json:"tempKey,omitempty" yaml:"tempKey" toml:"tempKey"`
|
|
DenyDate *time.Time `json:"denyDate,omitempty" yaml:"denyDate" toml:"denyDate"`
|
|
}
|
|
|
|
func (a *Auth) State() StateType {
|
|
if nil != a.TempKey && "" != *a.TempKey {
|
|
return StateTypeRegisterd
|
|
}
|
|
return StateTypeNotRegisterd
|
|
}
|