Do SSH key validation only if the user doesn't have an existing key and
the user has input some value in the add ssh key field
This commit is contained in:
		
					parent
					
						
							
								34c917acc2
							
						
					
				
			
			
				commit
				
					
						feeb102f92
					
				
			
		
					 3 changed files with 32 additions and 23 deletions
				
			
		|  | @ -187,7 +187,8 @@ class UserHostingKeyForm(forms.ModelForm): | |||
|         alerts the user of it. | ||||
|         :return: | ||||
|         """ | ||||
|         if 'generate' in self.request.POST: | ||||
|         if ('generate' in self.request.POST | ||||
|                 or not self.fields['public_key'].required): | ||||
|             return self.data.get('public_key') | ||||
|         KEY_ERROR_MESSAGE = _("Please input a proper SSH key") | ||||
|         openssh_pubkey_str = self.data.get('public_key').strip() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue