mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
fix: unable to recover user from trash or permanently delete them #552
This commit is contained in:
parent
53eac765a2
commit
796005fad4
5 changed files with 476 additions and 483 deletions
|
@ -1,7 +1,7 @@
|
|||
package user
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitAuthRouter(r *gin.RouterGroup) {
|
||||
|
@ -18,6 +18,7 @@ func InitManageUserRouter(r *gin.RouterGroup) {
|
|||
r.POST("user", AddUser)
|
||||
r.POST("user/:id", EditUser)
|
||||
r.DELETE("user/:id", DeleteUser)
|
||||
r.PATCH("user/:id", RecoverUser)
|
||||
}
|
||||
|
||||
func InitUserRouter(r *gin.RouterGroup) {
|
||||
|
@ -26,6 +27,6 @@ func InitUserRouter(r *gin.RouterGroup) {
|
|||
r.POST("/otp_enroll", EnrollTOTP)
|
||||
r.POST("/otp_reset", ResetOTP)
|
||||
|
||||
r.GET("/otp_secure_session_status", SecureSessionStatus)
|
||||
r.GET("/otp_secure_session_status", SecureSessionStatus)
|
||||
r.POST("/otp_secure_session", StartSecure2FASession)
|
||||
}
|
||||
|
|
|
@ -118,19 +118,15 @@ func EditUser(c *gin.Context) {
|
|||
|
||||
func DeleteUser(c *gin.Context) {
|
||||
id := cast.ToInt(c.Param("id"))
|
||||
|
||||
if cast.ToInt(id) == 1 {
|
||||
c.JSON(http.StatusNotAcceptable, gin.H{
|
||||
"message": "Prohibit deleting the default user",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
u := query.Auth
|
||||
err := u.DeleteByID(id)
|
||||
if err != nil {
|
||||
api.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusNoContent, nil)
|
||||
cosy.Core[model.Auth](c).Destroy()
|
||||
}
|
||||
|
||||
func RecoverUser(c *gin.Context) {
|
||||
cosy.Core[model.Auth](c).Recover()
|
||||
}
|
||||
|
|
|
@ -14,15 +14,15 @@
|
|||
"@0xjacky/vue-github-button": "^3.1.1",
|
||||
"@ant-design/icons-vue": "^7.0.1",
|
||||
"@formkit/auto-animate": "^0.8.2",
|
||||
"@vue/reactivity": "^3.4.38",
|
||||
"@vue/shared": "^3.4.38",
|
||||
"@vue/reactivity": "^3.5.5",
|
||||
"@vue/shared": "^3.5.5",
|
||||
"@vueuse/components": "^11.0.3",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"@vueuse/integrations": "^11.0.3",
|
||||
"@xterm/addon-attach": "^0.11.0",
|
||||
"@xterm/addon-fit": "^0.10.0",
|
||||
"@xterm/xterm": "^5.5.0",
|
||||
"ant-design-vue": "^4.2.3",
|
||||
"ant-design-vue": "^4.2.4",
|
||||
"apexcharts": "^3.53.0",
|
||||
"axios": "^1.7.7",
|
||||
"dayjs": "^1.11.13",
|
||||
|
@ -35,11 +35,11 @@
|
|||
"reconnecting-websocket": "^4.4.0",
|
||||
"sortablejs": "^1.15.3",
|
||||
"universal-cookie": "^7.2.0",
|
||||
"vite-plugin-build-id": "^0.3.5",
|
||||
"vue": "^3.4.38",
|
||||
"vue-router": "^4.4.3",
|
||||
"vite-plugin-build-id": "^0.3.6",
|
||||
"vue": "^3.5.5",
|
||||
"vue-router": "^4.4.5",
|
||||
"vue3-ace-editor": "2.2.4",
|
||||
"vue3-apexcharts": "1.6.0",
|
||||
"vue3-apexcharts": "1.5.3",
|
||||
"vue3-gettext": "3.0.0-beta.5",
|
||||
"vue3-otp-input": "^0.5.21",
|
||||
"vuedraggable": "^4.1.0"
|
||||
|
@ -53,27 +53,27 @@
|
|||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"@vitejs/plugin-vue": "^5.1.3",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||
"@vue/compiler-sfc": "^3.4.38",
|
||||
"@vue/compiler-sfc": "^3.5.5",
|
||||
"@vue/tsconfig": "^0.5.1",
|
||||
"ace-builds": "^1.36.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-import-resolver-alias": "^1.1.2",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-import": "^2.30.0",
|
||||
"eslint-plugin-regex": "^1.10.0",
|
||||
"eslint-plugin-sonarjs": "^0.23.0",
|
||||
"eslint-plugin-vue": "^9.27.0",
|
||||
"eslint-plugin-vue": "^9.28.0",
|
||||
"less": "^4.2.0",
|
||||
"postcss": "^8.4.44",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"postcss": "^8.4.47",
|
||||
"tailwindcss": "^3.4.11",
|
||||
"typescript": "5.5.4",
|
||||
"unplugin-auto-import": "^0.18.2",
|
||||
"unplugin-auto-import": "^0.18.3",
|
||||
"unplugin-vue-components": "^0.27.4",
|
||||
"unplugin-vue-define-options": "^1.4.9",
|
||||
"vite": "^5.4.2",
|
||||
"unplugin-vue-define-options": "^1.5.1",
|
||||
"vite": "^5.4.5",
|
||||
"vite-svg-loader": "^5.1.0",
|
||||
"vue-tsc": "^2.1.4"
|
||||
"vue-tsc": "^2.1.6"
|
||||
},
|
||||
"packageManager": "pnpm@9.6.0"
|
||||
}
|
||||
|
|
905
app/pnpm-lock.yaml
generated
905
app/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -2,15 +2,12 @@
|
|||
import type { Bread } from '@/components/Breadcrumb/types'
|
||||
import { useBreadcrumbs } from '@/composables/useBreadcrumbs'
|
||||
|
||||
const name = ref()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const computedBreadList = computed(() => {
|
||||
const result: Bread[] = []
|
||||
|
||||
name.value = route.meta.name
|
||||
|
||||
route.matched.forEach(item => {
|
||||
if (item.meta?.lastRouteName) {
|
||||
const lastRoute = router.resolve({ name: item.meta.lastRouteName })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue