Fix SMTP auth logic

tokarchuk/v1.17
Unknwon 10 years ago
parent 1126522a99
commit 405ee14711
  1. 2
      gogs.go
  2. 6
      models/login.go
  3. 20
      models/user.go
  4. 2
      templates/.VERSION

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.5.4.1001 Beta" const APP_VER = "0.5.4.1003 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

@ -161,12 +161,8 @@ func UserSignIn(uname, passwd string) (*User, error) {
return nil, err return nil, err
} }
if u.LoginType == NOTYPE { if u.LoginType == NOTYPE && has {
if has {
u.LoginType = PLAIN u.LoginType = PLAIN
} else {
return nil, ErrUserNotExist
}
} }
// For plain login, user must exist to reach this line. // For plain login, user must exist to reach this line.

@ -600,27 +600,27 @@ type Follow struct {
// FollowUser marks someone be another's follower. // FollowUser marks someone be another's follower.
func FollowUser(userId int64, followId int64) (err error) { func FollowUser(userId int64, followId int64) (err error) {
session := x.NewSession() sess := x.NewSession()
defer session.Close() defer sess.Close()
session.Begin() sess.Begin()
if _, err = session.Insert(&Follow{UserId: userId, FollowId: followId}); err != nil { if _, err = sess.Insert(&Follow{UserId: userId, FollowId: followId}); err != nil {
session.Rollback() sess.Rollback()
return err return err
} }
rawSql := "UPDATE `user` SET num_followers = num_followers + 1 WHERE id = ?" rawSql := "UPDATE `user` SET num_followers = num_followers + 1 WHERE id = ?"
if _, err = session.Exec(rawSql, followId); err != nil { if _, err = sess.Exec(rawSql, followId); err != nil {
session.Rollback() sess.Rollback()
return err return err
} }
rawSql = "UPDATE `user` SET num_followings = num_followings + 1 WHERE id = ?" rawSql = "UPDATE `user` SET num_followings = num_followings + 1 WHERE id = ?"
if _, err = session.Exec(rawSql, userId); err != nil { if _, err = sess.Exec(rawSql, userId); err != nil {
session.Rollback() sess.Rollback()
return err return err
} }
return session.Commit() return sess.Commit()
} }
// UnFollowUser unmarks someone be another's follower. // UnFollowUser unmarks someone be another's follower.

@ -1 +1 @@
0.5.4.1001 Beta 0.5.4.1003 Beta
Loading…
Cancel
Save