Browse Source

Fix SMTP auth logic

for-closed-social
Unknwon 10 years ago
parent
commit
405ee14711
4 changed files with 14 additions and 18 deletions
  1. +1
    -1
      gogs.go
  2. +2
    -6
      models/login.go
  3. +10
    -10
      models/user.go
  4. +1
    -1
      templates/.VERSION

+ 1
- 1
gogs.go View File

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

+ 2
- 6
models/login.go View File

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

+ 10
- 10
models/user.go View File

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

+ 1
- 1
templates/.VERSION View File

@ -1 +1 @@
0.5.4.1001 Beta
0.5.4.1003 Beta

Loading…
Cancel
Save