Documentation ¶
Index ¶
- Constants
- func ErrorToJsonString(prepend string, err error) string
- func LoginAuth(username, password string) smtp.Auth
- func RandomCode() string
- func ReadReply[T ReplyInterface](reply *Reply) *T
- type Client
- type CreateAccountReply
- type CreateAccountRequest
- type Credentials
- type MailSettings
- type Reply
- type ReplyInterface
- type ReplyStatus
- type Request
- type RequestInterface
- type ValidationCodeReply
- type ValidationCodeRequest
- type Webservice
- func (ws *Webservice) AddUser(username, password string)
- func (ws *Webservice) AnswerRequest(w http.ResponseWriter, raw_data []byte, r RequestInterface, username string)
- func (ws *Webservice) BasicAuth(h httprouter.Handle) httprouter.Handle
- func (ws *Webservice) DelUser(username, password string) bool
- func (ws *Webservice) GetAccount(account string) tiedb.Collection
- func (ws *Webservice) GetPassword(user string) (exists bool, password string)
- func (ws *Webservice) GetValidationCode(user string) string
- func (ws *Webservice) ListenAndServe(routes func(*httprouter.Router))
- func (ws *Webservice) RequestHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (ws *Webservice) SetMailSettings(mail MailSettings)
- func (ws *Webservice) UpdatePassword(username, password, newpassword string) bool
- func (ws *Webservice) Validate(user, code string) bool
- type WebserviceConfig
Constants ¶
View Source
const ( PASSWORDFIELD = "password" MAILSETTINGSDB = "mailsettingsdb" REQUESTVALIDATIONCODE = "requestvalidationcode" REQUESTCREATEACCOUNT = "requestcreateaccount" VALIDATIONCHARS = "0123456789" MAIL = "mail" // Used for mail settings db SERVER = "server" // Used for mail settings db FROM = "from" // Used for mail settings db SUBJECT = "subject" // Used for mail settings db USERNAME = "username" // Used for mail settings db PASSWORD = "password" // Used for mail settings db MESSAGE = "message" // Used for mail settings db VALIDATIONLENGTH = 4 )
View Source
const (
IdCreateAccount = "CreateAccount"
)
View Source
const (
IdValidationCode = "ValidationCode"
)
View Source
const (
ReplyTypeEmpty = "Empty"
)
Variables ¶
This section is empty.
Functions ¶
func ErrorToJsonString ¶
func RandomCode ¶
func RandomCode() string
func ReadReply ¶
func ReadReply[T ReplyInterface](reply *Reply) *T
Types ¶
type CreateAccountReply ¶
type CreateAccountReply struct {
ReplyStatus
}
type CreateAccountRequest ¶
type CreateAccountRequest struct { Request Email string Password string ValidationCode string // contains filtered or unexported fields }
func NewCreateAccountRequest ¶
func NewCreateAccountRequest() *CreateAccountRequest
func (*CreateAccountRequest) Reply ¶
func (request *CreateAccountRequest) Reply(username string, account func(string) tiedb.Collection) (Reply, error)
type Credentials ¶
type MailSettings ¶
type MailSettings struct { Server string From string Subject string Username string Password string Message string }
func ReadMailSettings ¶
func ReadMailSettings(result *tiedb.StringSliceSet, code string) MailSettings
type Reply ¶
type Reply struct { RequestName string ReplyStructPtr interface{} }
func (*Reply) DataCreateAccount ¶
func (reply *Reply) DataCreateAccount() *CreateAccountReply
func (*Reply) DataValidationCode ¶
func (reply *Reply) DataValidationCode() *ValidationCodeReply
type ReplyInterface ¶
type ReplyStatus ¶
func (ReplyStatus) GetMessage ¶
func (r ReplyStatus) GetMessage() string
func (ReplyStatus) GetSuccess ¶
func (r ReplyStatus) GetSuccess() bool
type Request ¶
type Request struct { Id string ReplyStructPtr interface{} }
func (*Request) GetReplyStructPtr ¶
func (r *Request) GetReplyStructPtr() interface{}
type RequestInterface ¶
type ValidationCodeReply ¶
type ValidationCodeReply struct {
ReplyStatus
}
type ValidationCodeRequest ¶
type ValidationCodeRequest struct { Request Email string // contains filtered or unexported fields }
func NewValidationCodeRequest ¶
func NewValidationCodeRequest() *ValidationCodeRequest
func (*ValidationCodeRequest) Reply ¶
func (request *ValidationCodeRequest) Reply(username string, account func(string) tiedb.Collection) (Reply, error)
type Webservice ¶
type Webservice struct {
// contains filtered or unexported fields
}
func NewWebservice ¶
func NewWebservice(config WebserviceConfig, requests []RequestInterface) *Webservice
func (*Webservice) AddUser ¶
func (ws *Webservice) AddUser(username, password string)
func (*Webservice) AnswerRequest ¶
func (ws *Webservice) AnswerRequest(w http.ResponseWriter, raw_data []byte, r RequestInterface, username string)
func (*Webservice) BasicAuth ¶
func (ws *Webservice) BasicAuth(h httprouter.Handle) httprouter.Handle
func (*Webservice) DelUser ¶
func (ws *Webservice) DelUser(username, password string) bool
func (*Webservice) GetAccount ¶
func (ws *Webservice) GetAccount(account string) tiedb.Collection
func (*Webservice) GetPassword ¶
func (ws *Webservice) GetPassword(user string) (exists bool, password string)
func (*Webservice) GetValidationCode ¶
func (ws *Webservice) GetValidationCode(user string) string
func (*Webservice) ListenAndServe ¶
func (ws *Webservice) ListenAndServe(routes func(*httprouter.Router))
func (*Webservice) RequestHandler ¶
func (ws *Webservice) RequestHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Webservice) SetMailSettings ¶
func (ws *Webservice) SetMailSettings(mail MailSettings)
func (*Webservice) UpdatePassword ¶
func (ws *Webservice) UpdatePassword(username, password, newpassword string) bool
func (*Webservice) Validate ¶
func (ws *Webservice) Validate(user, code string) bool
Click to show internal directories.
Click to hide internal directories.