optimize /admin/login-options
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
|||||||
"Gwen/service"
|
"Gwen/service"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Login struct {
|
type Login struct {
|
||||||
@@ -91,13 +90,7 @@ func (ct *Login) Logout(c *gin.Context) {
|
|||||||
// @Failure 500 {object} response.ErrorResponse
|
// @Failure 500 {object} response.ErrorResponse
|
||||||
// @Router /admin/login-options [post]
|
// @Router /admin/login-options [post]
|
||||||
func (ct *Login) LoginOptions(c *gin.Context) {
|
func (ct *Login) LoginOptions(c *gin.Context) {
|
||||||
res := service.AllService.OauthService.List(1, 100, func(tx *gorm.DB) {
|
ops := service.AllService.OauthService.GetOauthProviders()
|
||||||
tx.Select("op").Order("id")
|
|
||||||
})
|
|
||||||
var ops []string
|
|
||||||
for _, v := range res.Oauths {
|
|
||||||
ops = append(ops, v.Op)
|
|
||||||
}
|
|
||||||
response.Success(c, gin.H{
|
response.Success(c, gin.H{
|
||||||
"ops": ops,
|
"ops": ops,
|
||||||
"register": global.Config.App.Register,
|
"register": global.Config.App.Register,
|
||||||
|
|||||||
Reference in New Issue
Block a user