return nil if the user is deleted in LoginByDb()

This commit is contained in:
Wenkai Yin 2016-03-30 14:36:38 +08:00
parent d8785196c0
commit 7fea8c55dd

View File

@ -69,7 +69,7 @@ func LoginByDb(auth models.AuthModel) (*models.User, error) {
o := orm.NewOrm()
var users []models.User
n, err := o.Raw(`select * from user where (username = ? or email = ?)`,
n, err := o.Raw(`select * from user where (username = ? or email = ?) and deleted = 0`,
auth.Principal, auth.Principal).QueryRows(&users)
if err != nil {
return nil, err