commons-go/config/noauthprobe/auth.go

27 lines
636 B
Go
Raw Normal View History

2018-04-26 07:37:59 +00:00
package noauthprobe
2018-04-12 06:07:36 +00:00
2018-04-26 07:53:29 +00:00
import (
"git.loafle.net/overflow/commons-go/core/util"
)
2018-04-12 06:07:36 +00:00
2018-04-12 06:09:26 +00:00
type AuthStateType int
2018-04-12 06:07:36 +00:00
const (
2018-04-12 06:09:26 +00:00
AuthStateTypeNotRegisterd AuthStateType = iota
AuthStateTypeRegisterd
2018-04-12 06:07:36 +00:00
)
type Auth struct {
2018-04-13 11:55:05 +00:00
TempKey *string `json:"tempKey,omitempty" yaml:"tempKey" toml:"tempKey"`
2018-04-26 07:53:29 +00:00
AcceptedDate *util.Timestamp `json:"acceptedDate,omitempty" yaml:"acceptedDate" toml:"acceptedDate"`
DeniedDate *util.Timestamp `json:"deniedDate,omitempty" yaml:"deniedDate" toml:"deniedDate"`
2018-04-12 06:07:36 +00:00
}
2018-04-12 06:09:26 +00:00
func (a *Auth) State() AuthStateType {
2018-04-12 06:07:36 +00:00
if nil != a.TempKey && "" != *a.TempKey {
2018-04-12 06:09:26 +00:00
return AuthStateTypeRegisterd
2018-04-12 06:07:36 +00:00
}
2018-04-12 06:09:26 +00:00
return AuthStateTypeNotRegisterd
2018-04-12 06:07:36 +00:00
}