-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新增选择本地文件上传密钥,上传后将密钥信息保存到数据库,连接时从数据库读取 #1303
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6d0bab6
# 新增 pkey 目录挂载
issacmark 31e00e6
# 修改显示名称,引导用户填写 pkey 文件的名称
issacmark cce914c
# 新增 ssh tunnel keys 默认存放文件夹
issacmark 0902cfb
# 将数据库的 pkey 名字与 pkey 目录拼接
issacmark 5b71dd7
# 后台 django q 菜单改为中文
issacmark 88821c4
# 对应增加 pkey 文本框
issacmark beb2112
# 通过 form 读取秘钥信息
issacmark 32e2422
# 新增 pkey 字段存储密钥信息
issacmark c33d6c1
Merge remote-tracking branch 'origin/new_pr' into new_pr
issacmark a34d3e1
# 改为使用 pkey 文件对象进行登录
issacmark 166ac3b
# 新增 pkey 字段存储密钥信息
issacmark a2cdf04
#
issacmark a24f90c
# 改为传入 pkey
issacmark 0ce4f40
# 新增本地保存 pkey 的路径
issacmark aa420a7
Update models.py
issacmark a4d66a8
Merge branch 'master' into new_pr
issacmark 2b59a0f
# 设置为相对路径
issacmark d9f2ddf
Merge remote-tracking branch 'origin/new_pr' into new_pr
issacmark e88478c
#
issacmark 5e31b8c
Merge branch 'master' into new_pr
issacmark 99e262d
#
issacmark 7eee255
Merge branch 'master' into new_pr
hhyo fd128c0
# 修复当填写了秘钥路径,秘钥文件不存在时的异常
issacmark ca9f519
# pkey 字段改为 EncryptedTextField
issacmark 3b78bea
# ssh 隧道功能修改
issacmark 6793607
Merge remote-tracking branch 'origin/new_pr' into new_pr
issacmark fe7fe9c
Merge branch 'master' into new_pr
hhyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
# -*- coding:utf-8 -*- | ||
""" | ||
--------------------------------------------------------- | ||
@project: issacmarkArchery | ||
@file: form | ||
@date: 2021/12/30 17:43 | ||
@author: mayp | ||
--------------------------------------------------------- | ||
""" | ||
from django.forms import ModelForm, Textarea | ||
from sql.models import Tunnel | ||
from django.core.exceptions import ValidationError | ||
|
||
|
||
class TunnelForm(ModelForm): | ||
class Meta: | ||
model = Tunnel | ||
fields = "__all__" | ||
widgets = { | ||
'PKey': Textarea(attrs={'cols': 40, 'rows': 8}), | ||
} | ||
|
||
def clean(self): | ||
cleaned_data = super().clean() | ||
if cleaned_data.get('pkey_path'): | ||
try: | ||
pkey_path = cleaned_data.get('pkey_path').read() | ||
if pkey_path: | ||
cleaned_data['pkey'] = str(pkey_path, 'utf-8').replace(r'\r', '').replace(r'\n', '') | ||
except IOError: | ||
raise ValidationError("秘钥文件不存在, 请勾选秘钥路径的清除选项再进行保存") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个语句存在语法错误,还有pkey_path变成了filefield,确认下是否需要调整字段格式