Documentation ¶
Index ¶
- Constants
- Variables
- type Capability
- type Login
- type Session
- type Storage
- func (storage *Storage) AttemptLogin(user string) (*Login, error)
- func (storage *Storage) ConfirmLogin(key, code string) (*Session, *Login, error)
- func (storage *Storage) DeleteSession(key string) error
- func (storage *Storage) DeleteTalk(ids ...int64) error
- func (storage *Storage) HasActiveVerification(user string) (bool, error)
- func (storage *Storage) HasTooManyLogins(user string) (bool, int, error)
- func (storage *Storage) InsertTalk(talk *Talk) error
- func (storage *Storage) Talk(id int64) (*Talk, error)
- func (storage *Storage) Talks() ([]*Talk, error)
- func (storage *Storage) UpcomingTalks() ([]*Talk, error)
- func (storage *Storage) UpdateTalk(talk *Talk) error
- func (storage *Storage) UploadImage(objectName, imageBase64 string) (string, error)
- func (storage *Storage) User(id string) (User, error)
- func (storage *Storage) Verify(secret string) error
- func (storage *Storage) VerifySession(key string) (string, error)
- type Talk
- type TooManyLoginsError
- type User
- type Verification
- type WrongCodeError
Constants ¶
View Source
const LoginMaxAttempts = 3
Variables ¶
View Source
var ( ErrLoginInvalidKey = errors.New("invalid key") ErrLoginExpired = errors.New("login expired") ErrInvalidInput = errors.New("invalid input") )
View Source
var TalkCategories = []string{
"software-engineering",
"distributed-systems",
"programming-languages",
"databases",
"scientific-computing",
"robotics",
"artificial-intelligence",
"automata-theory",
"computer-networks",
"computer-vision",
"computer-architecture",
"bioinformatics",
"operating-systems",
"data-structures",
"computer-graphics",
"medicine",
"computer-security",
"logic",
"data-analytics",
"machine-learning",
"formal-methods",
"master-thesis",
"bachelor-thesis",
"others",
}
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability string
const ( CapabilityAdmin Capability = "admin" CapabilityImageUploads Capability = "img-uploads" )
type Login ¶
type Session ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage provides capabilities to access and manage both user and individual post data.
func (*Storage) ConfirmLogin ¶
func (*Storage) DeleteSession ¶
func (*Storage) DeleteTalk ¶
func (*Storage) HasActiveVerification ¶
func (*Storage) HasTooManyLogins ¶
func (*Storage) InsertTalk ¶
func (*Storage) UpcomingTalks ¶
func (*Storage) UpdateTalk ¶
func (*Storage) UploadImage ¶
type Talk ¶
type Talk struct { ID int64 `json:"i,omitempty"` Rank int64 `json:"-"` User string `json:"u"` Title string `json:"t"` Category string `json:"c"` Date time.Time `json:"d"` Link string `json:"l,omitempty"` LinkDomain string `json:"-"` Body string `json:"b,omitempty"` Image string `json:"z,omitempty"` ImageURL string `json:"-"` }
func (*Talk) RenderAsHTML ¶
type TooManyLoginsError ¶
type TooManyLoginsError struct {
Timeout int
}
func (TooManyLoginsError) Error ¶
func (err TooManyLoginsError) Error() string
type User ¶
type User struct { // The unique TUMonline identifier for this user. ID string `json:"i"` Capabilities []Capability `json:"c"` }
func (*User) HasCapability ¶
func (u *User) HasCapability(cap Capability) bool
Returns true if the user has the specified capability.
type Verification ¶
func (*Verification) Active ¶
func (v *Verification) Active() bool
type WrongCodeError ¶
func (WrongCodeError) Error ¶
func (err WrongCodeError) Error() string
Click to show internal directories.
Click to hide internal directories.