Documentation ¶
Index ¶
- Variables
- func HasUser(user *models.User, username string) bool
- func VerifyPassword(rawPwd, encodedPwd string) bool
- func VerifyUser(user *models.User, username, password string) (success bool)
- type AdminPanelController
- type AjaxController
- type ArticleController
- type BaseController
- func (CTRL *BaseController) ConfigPage(page string)
- func (CTRL *BaseController) GetActiveAds() map[string]string
- func (CTRL *BaseController) GetBlocks() map[string]string
- func (CTRL *BaseController) GetCache()
- func (CTRL *BaseController) GetContent() string
- func (CTRL *BaseController) GetDB(db ...string) orm.Ormer
- func (CTRL *BaseController) GetModuleMenu() string
- type IndexController
- type LoginController
- type ProfileController
- type UserPanelController
- type VendorPanelController
Constants ¶
This section is empty.
Variables ¶
View Source
var AuthRequest = func(ctx *context.Context) { uid, ok := ctx.Input.Session(sessionName).(int) if !ok && ctx.Input.URI() != "/login" && ctx.Input.URI() != "/register" { ctx.Redirect(302, "/login") return } var user models.User var err error qs := orm.NewOrm() user.Id = uid err = qs.Read(&user, "Id") if err != nil { ctx.Redirect(302, "/login") return } qs.LoadRelated(&user, "Profile") ctx.Input.SetData("user", user) }
AuthRequest "filter" to limit request based on sessionid
View Source
var DetectUserAgent = func(ctx *context.Context) { deviceDetector := mobiledetect.NewMobileDetect(ctx.Request, nil) ctx.Request.ParseForm() device := "" if len(ctx.Request.Form["device_type"]) != 0 { device = ctx.Request.Form["device_type"][0] } if device == "" { device = ctx.Input.Cookie("Device-Type") } if device == "" { if deviceDetector.IsMobile() { device = "mobile" } if deviceDetector.IsTablet() { device = "tablet" } if device == "" { device, _ = web.AppConfig.String("DefaultDevice") if device == "" { device = "desktop" } } } ctx.Output.Cookie("Device-Type", device) ctx.Input.SetData("device_type", device) }
DetectUserAgent detects device type and set it into a cookie
Functions ¶
func VerifyPassword ¶
VerifyPassword checks if pwd is correct
Types ¶
type AdminPanelController ¶
type AdminPanelController struct {
BaseController
}
AdminPanelController ...
type AjaxController ¶
type AjaxController struct {
BaseController
}
func (*AjaxController) GetImageUploadStatus ¶
func (CTRL *AjaxController) GetImageUploadStatus()
type BaseController ¶
type BaseController struct { web.Controller // contains filtered or unexported fields }
BaseController Extendable
func (*BaseController) ConfigPage ¶
func (CTRL *BaseController) ConfigPage(page string)
ConfigPage receives template name and makes basic config to render it
func (*BaseController) GetActiveAds ¶
func (CTRL *BaseController) GetActiveAds() map[string]string
func (*BaseController) GetBlocks ¶
func (CTRL *BaseController) GetBlocks() map[string]string
func (*BaseController) GetCache ¶
func (CTRL *BaseController) GetCache()
GetCache set the cache connector into our controller
func (*BaseController) GetContent ¶
func (CTRL *BaseController) GetContent() string
GetContent gets contents
func (*BaseController) GetDB ¶
func (CTRL *BaseController) GetDB(db ...string) orm.Ormer
GetDB set the orm connector into our controller if repication activated we use slave to Slave
func (*BaseController) GetModuleMenu ¶
func (CTRL *BaseController) GetModuleMenu() string
GetModuleMenu retrieves menu
type IndexController ¶
type IndexController struct {
BaseController
}
type LoginController ¶
type LoginController struct {
BaseController
}
LoginController ...
func (*LoginController) RegisterView ¶
func (CTRL *LoginController) RegisterView()
RegisterView displays register form
type ProfileController ¶
type ProfileController struct {
BaseController
}
ProfileController for users
func (*ProfileController) UserPanelView ¶
func (CTRL *ProfileController) UserPanelView()
UserPanelView Display user's homepage
type UserPanelController ¶
type UserPanelController struct {
BaseController
}
UserPanelController ...
type VendorPanelController ¶
type VendorPanelController struct {
BaseController
}
VendorPanelController ...
Click to show internal directories.
Click to hide internal directories.