Documentation
¶
Index ¶
- Constants
- func ChangePassword(id int64, old string, new string) error
- type Authority
- type BasicModel
- type JsonTime
- type User
- func (u *User) ActivateUser() error
- func (u *User) AddUser() error
- func (u *User) BanUser() error
- func (u *User) ChangeCellphone() error
- func (u *User) ChangeEmail() error
- func (u *User) GetUser(id int64) error
- func (u *User) Login() error
- func (u *User) RestrictUser() error
- func (u *User) TableName() string
- func (u *User) UpdateUserProfile(id int64) error
Constants ¶
View Source
const ( Inactive = 0 // sign up but has not been activated Normal = 1 // Restricted = 2 // login is permitted, but can only receive read-only message Banned = 3 // can't login )
Define user's status
View Source
const ( Unknown = 0 Male = 1 Female = 2 )
Gender
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authority ¶
type Authority struct {
BasicModel `xorm:"extends"`
Role string
User []User `xorm:"extends"`
}
type BasicModel ¶
type User ¶
type User struct {
BasicModel `xorm:"extends"`
Username string `json:"username"`
Password string `json:"password,omitempty"`
Avatar []byte `json:"avatar,omitempty" xorm:"-"`
Age int `json:"age,omitempty"`
Gender int `json:"gender,omitempty"`
Address string `json:"address,omitempty"`
Description string `json:"description,omitempty"`
Email *string `json:"email,omitempty"`
Cellphone *string `json:"cellphone,omitempty"`
Auth []Authority `json:"-" xorm:"extends"`
Status int `json:"-"`
LastLogin JsonTime `json:"-"`
LastModify JsonTime `json:"-"`
}
func (*User) ActivateUser ¶
func (*User) AddUser ¶
AddUser will add a new user. Users can sign up by email address or cellphone number.
func (*User) ChangeCellphone ¶
func (*User) ChangeEmail ¶
func (*User) GetUser ¶
GetUser provides user's information. Note that password, email address and cellphone number won't return.
func (*User) Login ¶
Login compares password provided by user and password stored in database. If user logs in successfully, login time will be recorded.
func (*User) RestrictUser ¶
func (*User) UpdateUserProfile ¶
UpdateUserProfile will update user's profile.
Click to show internal directories.
Click to hide internal directories.