Do not allow comma in SSH key name
This commit is contained in:
		
					parent
					
						
							
								c9c91b1ecb
							
						
					
				
			
			
				commit
				
					
						0104a804c2
					
				
			
		
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
 | 
					 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from django import forms
 | 
					from django import forms
 | 
				
			||||||
from django.conf import settings
 | 
					from django.conf import settings
 | 
				
			||||||
from django.contrib.auth import authenticate
 | 
					from django.contrib.auth import authenticate
 | 
				
			||||||
| 
						 | 
					@ -214,6 +214,10 @@ class UserHostingKeyForm(forms.ModelForm):
 | 
				
			||||||
        return openssh_pubkey_str
 | 
					        return openssh_pubkey_str
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def clean_name(self):
 | 
					    def clean_name(self):
 | 
				
			||||||
 | 
					        INVALID_NAME_MESSAGE = _("Comma not accepted in the name of the key")
 | 
				
			||||||
 | 
					        if "," in self.data.get('name'):
 | 
				
			||||||
 | 
					            logger.debug(INVALID_NAME_MESSAGE)
 | 
				
			||||||
 | 
					            raise forms.ValidationError(INVALID_NAME_MESSAGE)
 | 
				
			||||||
        return self.data.get('name')
 | 
					        return self.data.get('name')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def clean_user(self):
 | 
					    def clean_user(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue