mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-26 17:36:35 +08:00
feat: 资源密码加密处理&登录密码加密加强等
This commit is contained in:
@@ -61,6 +61,14 @@ func (d *Db) Save(rc *ctx.ReqCtx) {
|
||||
d.DbApp.Save(db)
|
||||
}
|
||||
|
||||
// 获取数据库实例密码,由于数据库是加密存储,故提供该接口展示原文密码
|
||||
func (d *Db) GetDbPwd(rc *ctx.ReqCtx) {
|
||||
dbId := GetDbId(rc.GinCtx)
|
||||
dbEntity := d.DbApp.GetById(dbId, "Password")
|
||||
dbEntity.PwdDecrypt()
|
||||
rc.ResData = dbEntity.Password
|
||||
}
|
||||
|
||||
// 获取数据库实例的所有数据库名
|
||||
func (d *Db) GetDatabaseNames(rc *ctx.ReqCtx) {
|
||||
form := &form.DbForm{}
|
||||
|
||||
@@ -72,6 +72,14 @@ func (m *Machine) SaveMachine(rc *ctx.ReqCtx) {
|
||||
m.MachineApp.Save(me)
|
||||
}
|
||||
|
||||
// 获取机器实例密码,由于数据库是加密存储,故提供该接口展示原文密码
|
||||
func (m *Machine) GetMachinePwd(rc *ctx.ReqCtx) {
|
||||
mid := GetMachineId(rc.GinCtx)
|
||||
me := m.MachineApp.GetById(mid, "Password")
|
||||
me.PwdDecrypt()
|
||||
rc.ResData = me.Password
|
||||
}
|
||||
|
||||
func (m *Machine) ChangeStatus(rc *ctx.ReqCtx) {
|
||||
g := rc.GinCtx
|
||||
id := uint64(ginx.PathParamInt(g, "machineId"))
|
||||
|
||||
@@ -52,6 +52,14 @@ func (r *Redis) Save(rc *ctx.ReqCtx) {
|
||||
r.RedisApp.Save(redis)
|
||||
}
|
||||
|
||||
// 获取redis实例密码,由于数据库是加密存储,故提供该接口展示原文密码
|
||||
func (r *Redis) GetRedisPwd(rc *ctx.ReqCtx) {
|
||||
rid := uint64(ginx.PathParamInt(rc.GinCtx, "id"))
|
||||
re := r.RedisApp.GetById(rid, "Password")
|
||||
re.PwdDecrypt()
|
||||
rc.ResData = re.Password
|
||||
}
|
||||
|
||||
func (r *Redis) DeleteRedis(rc *ctx.ReqCtx) {
|
||||
r.RedisApp.Delete(uint64(ginx.PathParamInt(rc.GinCtx, "id")))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user