本文整理汇总了Golang中github.com/varding/wetalk/modules/models.User.IsActive方法的典型用法代码示例。如果您正苦于以下问题:Golang User.IsActive方法的具体用法?Golang User.IsActive怎么用?Golang User.IsActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/varding/wetalk/modules/models.User
的用法示例。
在下文中一共展示了User.IsActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Active
// Active implemented check Email actice code.
func (this *RegisterRouter) Active() {
this.TplNames = "auth/active.html"
// no need active
if this.CheckActiveRedirect(false) {
return
}
code := this.GetString(":code")
var user models.User
if auth.VerifyUserActiveCode(&user, code) {
user.IsActive = true
user.Rands = models.GetUserSalt()
if err := user.Update("IsActive", "Rands", "Updated"); err != nil {
beego.Error("Active: user Update ", err)
}
if this.IsLogin {
this.User = user
}
this.Redirect("/active/success", 302)
} else {
this.Data["Success"] = false
}
}
示例2: ResetPost
// Reset implemented user password reset.
func (this *ForgotRouter) ResetPost() {
this.TplNames = "auth/reset.html"
code := this.GetString(":code")
this.Data["Code"] = code
var user models.User
if auth.VerifyUserResetPwdCode(&user, code) {
this.Data["Success"] = true
form := auth.ResetPwdForm{}
if this.ValidFormSets(&form) == false {
return
}
user.IsActive = true
user.Rands = models.GetUserSalt()
if err := auth.SaveNewPassword(&user, form.Password); err != nil {
beego.Error("ResetPost Save New Password: ", err)
}
if this.IsLogin {
auth.LogoutUser(this.Ctx)
}
this.FlashRedirect("/login", 302, "ResetSuccess")
} else {
this.Data["Success"] = false
}
}
示例3: SaveUserProfile
func (form *ProfileForm) SaveUserProfile(user *models.User) error {
// set md5 value if the value is an email
if strings.IndexRune(form.GrEmail, '@') != -1 {
form.GrEmail = utils.EncodeMd5(form.GrEmail)
}
changes := utils.FormChanges(user, form)
if len(changes) > 0 {
// if email changed then need re-active
if user.Email != form.Email {
user.IsActive = false
changes = append(changes, "IsActive")
}
utils.SetFormValues(form, user)
return user.Update(changes...)
}
return nil
}