Shorten generated ssh key and add seconds to the name
This commit is contained in:
parent
12fe1fa722
commit
0706ac5909
2 changed files with 2 additions and 3 deletions
|
@ -15,8 +15,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def generate_ssh_key_name():
|
||||
return 'dcl-generated-key-' + datetime.datetime.now().strftime(
|
||||
'%m%d%y%H%M')
|
||||
return 'dcl-gen-key-' + datetime.datetime.now().strftime('%m%d%y%H%M%S')
|
||||
|
||||
|
||||
class HostingUserLoginForm(forms.Form):
|
||||
|
|
|
@ -487,7 +487,7 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView):
|
|||
|
||||
def form_valid(self, form):
|
||||
form.save()
|
||||
if 'dcl-generated-key-' in form.instance.name:
|
||||
if 'dcl-gen-key-' in form.instance.name:
|
||||
content = ContentFile(form.cleaned_data.get('private_key'))
|
||||
filename = form.cleaned_data.get(
|
||||
'name') + '_' + str(uuid.uuid4())[:8] + '_private.pem'
|
||||
|
|
Loading…
Reference in a new issue