Documentation ¶
Index ¶
- func CanRegistered(userName string, email string) (bool, bool, error)
- func CreateUserActiveCode(user *models.User, startInf interface{}) string
- func CreateUserResetPwdCode(user *models.User, startInf interface{}) string
- func DeleteRememberCookie(ctx *context.Context)
- func GetLoginRedirect(ctx *context.Context) string
- func GetUserFromSession(user *models.User, sess session.Store) bool
- func GetUserIdFromSession(sess session.Store) int
- func HasUser(user *models.User, username string) bool
- func LoginUser(user *models.User, ctx *context.Context, remember bool)
- func LoginUserFromRememberCookie(user *models.User, ctx *context.Context) (success bool)
- func LogoutUser(ctx *context.Context)
- func RegisterUser(user *models.User, username, email, password string) error
- func SaveNewPassword(user *models.User, password string) error
- func SendActiveMail(locale i18n.Locale, user *models.User)
- func SendRegisterMail(locale i18n.Locale, user *models.User)
- func SendResetPwdMail(locale i18n.Locale, user *models.User)
- func UserFollow(user *models.User, theUser *models.User)
- func UserUnFollow(user *models.User, theUser *models.User)
- func VerifyPassword(rawPwd, encodedPwd string) bool
- func VerifyUser(user *models.User, username, password string) (success bool)
- func VerifyUserActiveCode(user *models.User, code string) bool
- func VerifyUserResetPwdCode(user *models.User, code string) bool
- func WriteRememberCookie(user *models.User, ctx *context.Context)
- type ForgotForm
- type LoginForm
- type OAuthLoginForm
- type OAuthRegisterForm
- type PasswordForm
- type ProfileForm
- func (form *ProfileForm) Helps() map[string]string
- func (form *ProfileForm) Labels() map[string]string
- func (form *ProfileForm) LangAddsSelectData() [][]string
- func (form *ProfileForm) LangSelectData() [][]string
- func (form *ProfileForm) Placeholders() map[string]string
- func (form *ProfileForm) SaveUserProfile(user *models.User) error
- func (form *ProfileForm) SetFromUser(user *models.User)
- func (form *ProfileForm) Valid(v *validation.Validation)
- type RegisterForm
- type ResetPwdForm
- type UserAdminForm
- func (form *UserAdminForm) Helps() map[string]string
- func (form *UserAdminForm) Labels() map[string]string
- func (form *UserAdminForm) LangAddsSelectData() [][]string
- func (form *UserAdminForm) LangSelectData() [][]string
- func (form *UserAdminForm) SetFromUser(user *models.User)
- func (form *UserAdminForm) SetToUser(user *models.User)
- func (form *UserAdminForm) Valid(v *validation.Validation)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanRegistered ¶
CanRegistered checks if the username or e-mail is available.
func CreateUserActiveCode ¶
create a time limit code for user active
func CreateUserResetPwdCode ¶
create a time limit code for user reset password
func DeleteRememberCookie ¶
func GetLoginRedirect ¶
get login redirect url from cookie
func GetUserFromSession ¶
get user if key exist in session
func GetUserIdFromSession ¶
func RegisterUser ¶
register create user
func SaveNewPassword ¶
set a new password to user
func SendActiveMail ¶
Send email verify active email.
func SendRegisterMail ¶
Send user register mail with active code
func SendResetPwdMail ¶
Send user reset password mail with verify code
func VerifyPassword ¶
compare raw password and encoded password
func VerifyUser ¶
verify username/email and password
func VerifyUserActiveCode ¶
verify active code when active account
func VerifyUserResetPwdCode ¶
verify code when reset password
Types ¶
type ForgotForm ¶
type ForgotForm struct { Email string `valid:"Required;Email;MaxSize(80)"` User *models.User `form:"-"` }
Forgot form
func (*ForgotForm) Helps ¶
func (form *ForgotForm) Helps() map[string]string
func (*ForgotForm) Labels ¶
func (form *ForgotForm) Labels() map[string]string
func (*ForgotForm) Valid ¶
func (form *ForgotForm) Valid(v *validation.Validation)
type LoginForm ¶
type LoginForm struct { UserName string `valid:"Required"` Password string `form:"type(password)" valid:"Required"` Remember bool }
Login form
type OAuthLoginForm ¶
type OAuthLoginForm struct { UserName string `valid:"Required"` Password string `form:"type(password)" valid:"Required"` }
OAuth connect Login form
func (*OAuthLoginForm) Labels ¶
func (form *OAuthLoginForm) Labels() map[string]string
type OAuthRegisterForm ¶
type OAuthRegisterForm struct { UserName string `valid:"Required;AlphaDash;MinSize(5);MaxSize(30)"` Email string `valid:"Required;Email;MaxSize(80)"` Password string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` PasswordRe string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` Locale i18n.Locale `form:"-"` }
OAuth connect Register form
func (*OAuthRegisterForm) Helps ¶
func (form *OAuthRegisterForm) Helps() map[string]string
func (*OAuthRegisterForm) Labels ¶
func (form *OAuthRegisterForm) Labels() map[string]string
func (*OAuthRegisterForm) Placeholders ¶
func (form *OAuthRegisterForm) Placeholders() map[string]string
func (*OAuthRegisterForm) Valid ¶
func (form *OAuthRegisterForm) Valid(v *validation.Validation)
type PasswordForm ¶
type PasswordForm struct { PasswordOld string `form:"type(password)" valid:"Required"` Password string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` PasswordRe string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` User *models.User `form:"-"` }
Change password form
func (*PasswordForm) Labels ¶
func (form *PasswordForm) Labels() map[string]string
func (*PasswordForm) Placeholders ¶
func (form *PasswordForm) Placeholders() map[string]string
func (*PasswordForm) Valid ¶
func (form *PasswordForm) Valid(v *validation.Validation)
type ProfileForm ¶
type ProfileForm struct { NickName string `valid:"Required;MaxSize(30)"` Url string `valid:"MaxSize(100)"` Company string `valid:"MaxSize(30)"` Location string `valid:"MaxSize(30)"` Info string `form:"type(textarea)" valid:"MaxSize(255)"` Email string `valid:"Required;Email;MaxSize(100)"` PublicEmail bool `valid:""` GrEmail string `valid:"Required;MaxSize(80)"` Github string `valid:"MaxSize(30)"` Twitter string `valid:"MaxSize(30)"` Google string `valid:"MaxSize(30)"` Weibo string `valid:"MaxSize(30)"` Linkedin string `valid:"MaxSize(30)"` Facebook string `valid:"MaxSize(30)"` Lang int `form:"type(select);attr(rel,select2)" valid:""` LangAdds models.SliceStringField `form:"type(select);attr(rel,select2);attr(multiple,multiple)" valid:""` Locale i18n.Locale `form:"-"` }
Settings Profile form
func (*ProfileForm) Helps ¶
func (form *ProfileForm) Helps() map[string]string
func (*ProfileForm) Labels ¶
func (form *ProfileForm) Labels() map[string]string
func (*ProfileForm) LangAddsSelectData ¶
func (form *ProfileForm) LangAddsSelectData() [][]string
func (*ProfileForm) LangSelectData ¶
func (form *ProfileForm) LangSelectData() [][]string
func (*ProfileForm) Placeholders ¶
func (form *ProfileForm) Placeholders() map[string]string
func (*ProfileForm) SaveUserProfile ¶
func (form *ProfileForm) SaveUserProfile(user *models.User) error
func (*ProfileForm) SetFromUser ¶
func (form *ProfileForm) SetFromUser(user *models.User)
func (*ProfileForm) Valid ¶
func (form *ProfileForm) Valid(v *validation.Validation)
type RegisterForm ¶
type RegisterForm struct { UserName string `valid:"Required;AlphaDash;MinSize(5);MaxSize(30)"` Email string `valid:"Required;Email;MaxSize(80)"` Password string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` PasswordRe string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` Captcha string `form:"type(captcha)" valid:"Required"` CaptchaId string `form:"type(empty)"` Locale i18n.Locale `form:"-"` }
Register form
func (*RegisterForm) Helps ¶
func (form *RegisterForm) Helps() map[string]string
func (*RegisterForm) Labels ¶
func (form *RegisterForm) Labels() map[string]string
func (*RegisterForm) Placeholders ¶
func (form *RegisterForm) Placeholders() map[string]string
func (*RegisterForm) Valid ¶
func (form *RegisterForm) Valid(v *validation.Validation)
type ResetPwdForm ¶
type ResetPwdForm struct { Password string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` PasswordRe string `form:"type(password)" valid:"Required;MinSize(4);MaxSize(30)"` }
Reset password form
func (*ResetPwdForm) Labels ¶
func (form *ResetPwdForm) Labels() map[string]string
func (*ResetPwdForm) Placeholders ¶
func (form *ResetPwdForm) Placeholders() map[string]string
func (*ResetPwdForm) Valid ¶
func (form *ResetPwdForm) Valid(v *validation.Validation)
type UserAdminForm ¶
type UserAdminForm struct { Create bool `form:"-"` Id int `form:"-"` UserName string `valid:"Required;AlphaDash;MinSize(5);MaxSize(30)"` Email string `valid:"Required;Email;MaxSize(100)"` PublicEmail bool `` NickName string `valid:"Required;MaxSize(30)"` Url string `valid:"MaxSize(100)"` Company string `valid:"MaxSize(30)"` Location string `valid:"MaxSize(30)"` Info string `form:"type(textarea)" valid:"MaxSize(255)"` GrEmail string `valid:"Required;MaxSize(80)"` Github string `valid:"MaxSize(30)"` Twitter string `valid:"MaxSize(30)"` Google string `valid:"MaxSize(30)"` Weibo string `valid:"MaxSize(30)"` Linkedin string `valid:"MaxSize(30)"` Facebook string `valid:"MaxSize(30)"` Followers int `` Following int `` IsAdmin bool `` IsActive bool `` IsForbid bool `` Lang int `form:"type(select);attr(rel,select2)" valid:""` LangAdds models.SliceStringField `form:"type(select);attr(rel,select2);attr(multiple,multiple)" valid:""` }
func (*UserAdminForm) Helps ¶
func (form *UserAdminForm) Helps() map[string]string
func (*UserAdminForm) Labels ¶
func (form *UserAdminForm) Labels() map[string]string
func (*UserAdminForm) LangAddsSelectData ¶
func (form *UserAdminForm) LangAddsSelectData() [][]string
func (*UserAdminForm) LangSelectData ¶
func (form *UserAdminForm) LangSelectData() [][]string
func (*UserAdminForm) SetFromUser ¶
func (form *UserAdminForm) SetFromUser(user *models.User)
func (*UserAdminForm) SetToUser ¶
func (form *UserAdminForm) SetToUser(user *models.User)
func (*UserAdminForm) Valid ¶
func (form *UserAdminForm) Valid(v *validation.Validation)