use yml
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
package models
|
||||
|
||||
type Contents struct {
|
||||
Cid int32 `gorm:"column:cid;primaryKey;autoIncrement:true" json:"cid"`
|
||||
Title string `gorm:"column:title" json:"title"`
|
||||
Slug string `gorm:"column:slug" json:"slug"`
|
||||
Created int32 `gorm:"column:created" json:"created"`
|
||||
Modified int32 `gorm:"column:modified" json:"modified"`
|
||||
Text string `gorm:"column:text" json:"text"`
|
||||
Order_ int32 `gorm:"column:order" json:"order"`
|
||||
AuthorID int32 `gorm:"column:authorId" json:"authorId"`
|
||||
Template string `gorm:"column:template" json:"template"`
|
||||
Type string `gorm:"column:type;default:post" json:"type"`
|
||||
Status string `gorm:"column:status;default:publish" json:"status"`
|
||||
Password string `gorm:"column:password" json:"password"`
|
||||
CommentsNum int32 `gorm:"column:commentsNum" json:"commentsNum"`
|
||||
AllowComment string `gorm:"column:allowComment;default:0" json:"allowComment"`
|
||||
AllowPing string `gorm:"column:allowPing;default:0" json:"allowPing"`
|
||||
AllowFeed string `gorm:"column:allowFeed;default:0" json:"allowFeed"`
|
||||
Parent int32 `gorm:"column:parent" json:"parent"`
|
||||
}
|
||||
@@ -40,7 +40,6 @@ func SetUp(isOrmDebug bool) {
|
||||
|
||||
DB.AutoMigrate(&Account{})
|
||||
DB.AutoMigrate(&Content{})
|
||||
DB.AutoMigrate(&Contents{})
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ func (a *Account) SetPassword(password string) error {
|
||||
// 验证登录帐户密码合法性
|
||||
func (a *Account) CheckPassword() bool {
|
||||
password := a.Password
|
||||
|
||||
aa, err1 := bcrypt.GenerateFromPassword([]byte(a.Password), 12)
|
||||
print(aa, err1)
|
||||
DB.Where("username = ?", a.Username).First(&a)
|
||||
err := bcrypt.CompareHashAndPassword([]byte(a.Password), []byte(password))
|
||||
return err == nil
|
||||
|
||||
Reference in New Issue
Block a user