29 lines
617 B
Go
Raw Normal View History

2018-04-12 18:38:04 +09:00
package config
2018-04-12 15:07:36 +09:00
import "time"
const (
2018-04-12 18:38:04 +09:00
ConfigFileName = "auth.json"
2018-04-12 15:07:36 +09:00
)
2018-04-12 15:09:26 +09:00
type AuthStateType int
2018-04-12 15:07:36 +09:00
const (
2018-04-12 15:09:26 +09:00
AuthStateTypeNotRegisterd AuthStateType = iota
AuthStateTypeRegisterd
2018-04-12 15:07:36 +09:00
)
type Auth struct {
2018-04-13 20:55:05 +09:00
TempKey *string `json:"tempKey,omitempty" yaml:"tempKey" toml:"tempKey"`
AcceptedDate *time.Time `json:"acceptedDate,omitempty" yaml:"acceptedDate" toml:"acceptedDate"`
DeniedDate *time.Time `json:"deniedDate,omitempty" yaml:"deniedDate" toml:"deniedDate"`
2018-04-12 15:07:36 +09:00
}
2018-04-12 15:09:26 +09:00
func (a *Auth) State() AuthStateType {
2018-04-12 15:07:36 +09:00
if nil != a.TempKey && "" != *a.TempKey {
2018-04-12 15:09:26 +09:00
return AuthStateTypeRegisterd
2018-04-12 15:07:36 +09:00
}
2018-04-12 15:09:26 +09:00
return AuthStateTypeNotRegisterd
2018-04-12 15:07:36 +09:00
}