mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-08 22:46:51 +08:00
fix(system): fix issue with change system ssl failed (#8247)
This commit is contained in:
parent
b3cd10b743
commit
f13d496b35
6 changed files with 18 additions and 4 deletions
|
@ -265,6 +265,7 @@ sqlInject: 'SQL 注入'
|
|||
ErrDBNotExist: "数据库不存在"
|
||||
allow: "允许"
|
||||
deny: "禁止"
|
||||
OpenrestyNotFound: "Openresty 未安装"
|
||||
|
||||
#task
|
||||
TaskStart: "{{.name}} 任务开始 [START]"
|
||||
|
|
|
@ -2,7 +2,6 @@ package v2
|
|||
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
|
||||
"github.com/1Panel-dev/1Panel/core/app/dto"
|
||||
"github.com/1Panel-dev/1Panel/core/app/model"
|
||||
|
|
|
@ -232,6 +232,7 @@ func (u *SettingService) UpdatePort(port uint) error {
|
|||
func (u *SettingService) UpdateSSL(c *gin.Context, req dto.SSLUpdate) error {
|
||||
secretDir := path.Join(global.CONF.Base.InstallDir, "1panel/secret")
|
||||
if req.SSL == constant.StatusDisable {
|
||||
c.SetCookie(constant.SessionName, "", -1, "/", "", false, true)
|
||||
if err := settingRepo.Update("SSL", constant.StatusDisable); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@ package common
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/1Panel-dev/1Panel/core/constant"
|
||||
"github.com/gin-gonic/gin"
|
||||
mathRand "math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
|
@ -205,3 +207,14 @@ func HandleIPList(content string) ([]string, error) {
|
|||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func deleteCookie(w http.ResponseWriter) {
|
||||
cookie := &http.Cookie{
|
||||
Name: constant.SessionName,
|
||||
Value: "",
|
||||
Path: "/",
|
||||
Expires: time.Unix(0, 0),
|
||||
MaxAge: -1,
|
||||
}
|
||||
http.SetCookie(w, cookie)
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ const systemRules: TokenRule[] = [
|
|||
const taskRules: TokenRule[] = [
|
||||
{
|
||||
type: 'bracket-text',
|
||||
pattern: /\[([^\,]]+)\]/g,
|
||||
pattern: /\[([^\]]+)\]/g,
|
||||
color: '#B87A2B',
|
||||
},
|
||||
];
|
||||
|
@ -108,7 +108,7 @@ const defaultRules: TokenRule[] = [
|
|||
},
|
||||
{
|
||||
type: 'ip',
|
||||
pattern: /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g,
|
||||
pattern: /\b(?<!\[)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b(?!\])/g,
|
||||
color: '#4A90E2',
|
||||
},
|
||||
{
|
||||
|
|
|
@ -245,7 +245,7 @@ const onSaveSSL = async (formEl: FormInstance | undefined) => {
|
|||
if (globalStore.entrance) {
|
||||
address = address.replaceAll('settings/safe', globalStore.entrance);
|
||||
} else {
|
||||
address = address.replaceAll('settings/safe', 'login');
|
||||
address = address.replaceAll('settings/safe', '');
|
||||
}
|
||||
setTimeout(() => {
|
||||
window.open(`https://${address}`, '_self');
|
||||
|
|
Loading…
Add table
Reference in a new issue