From ab4eb0252476916915646d7e0364bfeb245c8114 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 19 May 2023 00:37:06 +0300 Subject: [PATCH] update --- app/Http/Controllers/AuthController.go | 12 ++++++---- app/Http/Controllers/CasbinRoleController.go | 24 +++++++++++++------- app/Http/Controllers/HomeController.go | 6 +++-- app/Http/Controllers/ResPassController.go | 9 +++++--- app/Http/Controllers/UserController.go | 12 ++++++---- app/Http/Controllers/WelcomeController.go | 3 ++- 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/app/Http/Controllers/AuthController.go b/app/Http/Controllers/AuthController.go index 5b88fe4a..4fb94434 100755 --- a/app/Http/Controllers/AuthController.go +++ b/app/Http/Controllers/AuthController.go @@ -55,7 +55,8 @@ func UsersRegistration(c *gin.Context) { user := Model.UserModel{ Name: input.Name, Email: input.Email, - Password: input.Password} + Password: input.Password, + } //Gorm_SQL config.DB.Save(&user) @@ -114,7 +115,8 @@ func UsersLogin(c *gin.Context) { c.IndentedJSON(http.StatusCreated, gin.H{ "message": "User signed in", "user": model.Name, - "id": model.ID}) + "id": model.ID, + }) } } @@ -226,11 +228,13 @@ func ViewUserSession(c *gin.Context) { if sessionID == nil { c.IndentedJSON(http.StatusOK, gin.H{ "userid_session_id": "no_auth", - "userid_session": "no_auth"}) + "userid_session": "no_auth", + }) } else { c.IndentedJSON(http.StatusOK, gin.H{ "userid_session_id": sessionID, - "userid_session": "auth"}) + "userid_session": "auth", + }) } } diff --git a/app/Http/Controllers/CasbinRoleController.go b/app/Http/Controllers/CasbinRoleController.go index e8ea34d9..dd35a54d 100755 --- a/app/Http/Controllers/CasbinRoleController.go +++ b/app/Http/Controllers/CasbinRoleController.go @@ -42,13 +42,15 @@ func AddPostCasbinRole(c *gin.Context) { e.AddPolicy( input.RoleName, input.Path, - input.Method) + input.Method, + ) // Create role role := Model.CasbinRoleModel{ RoleName: input.RoleName, Path: input.Path, - Method: input.Method} + Method: input.Method, + } //Gorm_SQL config.DB.Save(&role) @@ -87,7 +89,8 @@ func ViewCasbinRole(c *gin.Context) { c.HTML(http.StatusOK, "admin_views_casbin_role.html", gin.H{ "session_id": sessionID, "session_name": sessionName, - "list": model}) + "list": model, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"}) @@ -118,7 +121,8 @@ func AddCasbinRole(c *gin.Context) { c.HTML(http.StatusOK, "admin_views_casbin_role_add.html", gin.H{ "csrf": csrf.GetToken(c), "session_id": sessionID, - "session_name": sessionName}) + "session_name": sessionName, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"}) @@ -141,7 +145,8 @@ func DeleteCasbinRole(c *gin.Context) { e.RemovePolicy( model.RoleName, model.Path, - model.Method) + model.Method, + ) config.DB.Delete(&model) @@ -169,7 +174,8 @@ func ApiViewCasbinRole(c *gin.Context) { "csrf": csrf.GetToken(c), "session_id": sessionID, "session_name": sessionName, - "list": model}) + "list": model, + }) } @@ -187,7 +193,8 @@ func ApiAddCasbinRole(c *gin.Context) { c.IndentedJSON(http.StatusOK, gin.H{ "csrf": csrf.GetToken(c), "session_id": sessionID, - "session_name": sessionName}) + "session_name": sessionName, + }) } @@ -206,7 +213,8 @@ func ApiDeleteCasbinRole(c *gin.Context) { e.RemovePolicy( model.RoleName, model.Path, - model.Method) + model.Method, + ) config.DB.Delete(&model) diff --git a/app/Http/Controllers/HomeController.go b/app/Http/Controllers/HomeController.go index 16fd0418..0a8ec7d9 100755 --- a/app/Http/Controllers/HomeController.go +++ b/app/Http/Controllers/HomeController.go @@ -38,7 +38,8 @@ func ViewHome(c *gin.Context) { //HTML template c.HTML(http.StatusOK, "admin_views_home.html", gin.H{ "session_id": sessionID, - "session_name": sessionName}) + "session_name": sessionName, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"}) @@ -60,6 +61,7 @@ func ApiViewHome(c *gin.Context) { c.IndentedJSON(http.StatusOK, gin.H{ "csrf": csrf.GetToken(c), "session_id": sessionID, - "session_name": sessionName}) + "session_name": sessionName, + }) } diff --git a/app/Http/Controllers/ResPassController.go b/app/Http/Controllers/ResPassController.go index 1a4fa953..0a50da23 100755 --- a/app/Http/Controllers/ResPassController.go +++ b/app/Http/Controllers/ResPassController.go @@ -87,7 +87,8 @@ func PostForgotPassword(c *gin.Context) { url_res := Model.ResPassUserModel{ Email: input.Email, Url_full: config.EnvFunc("WWWROOT") + "/login/pass/" + rand_urls, - Url: rand_urls} + Url: rand_urls, + } config.DB.Save(&url_res) @@ -129,7 +130,8 @@ func ViewRes_passListPrev(c *gin.Context) { // Get model if exist //HTML template c.HTML(http.StatusOK, "admin_auth_forgot_password_new.html", gin.H{ "csrf": csrf.GetToken(c), - "url": model.Url}) + "url": model.Url, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"}) @@ -212,5 +214,6 @@ func ApiViewRes_passListPrev(c *gin.Context) { c.IndentedJSON(http.StatusOK, gin.H{ "csrf": csrf.GetToken(c), - "url": model.Url}) + "url": model.Url, + }) } diff --git a/app/Http/Controllers/UserController.go b/app/Http/Controllers/UserController.go index 19af2540..47fde146 100755 --- a/app/Http/Controllers/UserController.go +++ b/app/Http/Controllers/UserController.go @@ -170,7 +170,8 @@ func ViewUsersList(c *gin.Context) { "csrf": csrf.GetToken(c), "session_id": sessionID, "session_name": sessionName, - "list": model}) + "list": model, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"}) @@ -242,7 +243,8 @@ func ViewAddUsers(c *gin.Context) { // Get model if exist c.HTML(http.StatusOK, "admin_views_users_add.html", gin.H{ "csrf": csrf.GetToken(c), "session_id": sessionID, - "session_name": sessionName}) + "session_name": sessionName, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"}) @@ -271,7 +273,8 @@ func ApiViewUsersList(c *gin.Context) { "csrf": csrf.GetToken(c), "session_id": sessionID, "session_name": sessionName, - "list": model}) + "list": model, + }) } @@ -289,7 +292,8 @@ func ApiViewAddUsers(c *gin.Context) { // Get model if exist c.IndentedJSON(http.StatusOK, gin.H{ "csrf": csrf.GetToken(c), "session_id": sessionID, - "session_name": sessionName}) + "session_name": sessionName, + }) } diff --git a/app/Http/Controllers/WelcomeController.go b/app/Http/Controllers/WelcomeController.go index 23dbf5b7..de32219c 100755 --- a/app/Http/Controllers/WelcomeController.go +++ b/app/Http/Controllers/WelcomeController.go @@ -30,7 +30,8 @@ func GetWelcome(c *gin.Context) { //HTML template c.HTML(http.StatusOK, "public_welcome.html", gin.H{ "title": "Larago", - "session_id": sessionID}) + "session_id": sessionID, + }) default: //VUE template c.HTML(http.StatusOK, "index.html", gin.H{"title": "Larago"})