File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ $("#create-vm").click(function(){
267267 const max_cpu = $ ( this ) . data ( 'max_cpu' ) ;
268268 const max_mem = $ ( this ) . data ( 'max_mem' ) ;
269269 const max_disk = $ ( this ) . data ( 'max_disk' ) ;
270+ var ssh_regex = new RegExp ( "ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3}( [^@]+@[^@]+)?" )
270271 var disk = document . getElementById ( 'disk' ) . value ;
271272 fetch ( `/template/${ template } /disk` , {
272273 credentials : 'same-origin' ,
@@ -279,7 +280,9 @@ $("#create-vm").click(function(){
279280 return disk
280281 } ) . then ( ( disk ) => {
281282 if ( name && disk ) {
282- if ( disk > max_disk ) {
283+ if ( ! ssh_regex . test ( ssh_key ) ) {
284+ swal ( "Uh oh..." , "Invalid SSH key!" , "error" ) ;
285+ } else if ( disk > max_disk ) {
283286 swal ( "Uh oh..." , `You do not have enough disk resources available! Please lower the VM disk size to ${ max_disk } GB or lower.` , "error" ) ;
284287 } else if ( template != 'none' && cores > max_cpu ) {
285288 swal ( "Uh oh..." , `You do not have enough CPU resources available! Please lower the VM cores to ${ max_cpu } or lower.` , "error" ) ;
You can’t perform that action at this time.
0 commit comments