From 41f56ad05d12520bb90f91889fa979465d0b3d6b Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Sat, 11 Apr 2020 20:18:05 +0800 Subject: login_source: migrate to GORM and add tests (#6090) * Use GORM in all write paths * Migrate to GORM * Fix lint errors * Use GORM to init table * dbutil: make writer detect error * Add more tests * Rename to clearTables * db: finish adding tests * osutil: add tests * Fix load source files path --- internal/route/user/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/route/user/auth.go') diff --git a/internal/route/user/auth.go b/internal/route/user/auth.go index 22e8176c..be23b78d 100644 --- a/internal/route/user/auth.go +++ b/internal/route/user/auth.go @@ -101,7 +101,7 @@ func Login(c *context.Context) { } // Display normal login page - loginSources, err := db.ActivatedLoginSources() + loginSources, err := db.LoginSources.List(db.ListLoginSourceOpts{OnlyActivated: true}) if err != nil { c.Error(err, "list activated login sources") return @@ -148,7 +148,7 @@ func afterLogin(c *context.Context, u *db.User, remember bool) { func LoginPost(c *context.Context, f form.SignIn) { c.Title("sign_in") - loginSources, err := db.ActivatedLoginSources() + loginSources, err := db.LoginSources.List(db.ListLoginSourceOpts{OnlyActivated: true}) if err != nil { c.Error(err, "list activated login sources") return -- cgit v1.2.3