mirror of
				https://github.com/Alamantus/otp-generator.git
				synced 2025-11-04 10:17:04 +01:00 
			
		
		
		
	Prevent padLength from getting below 1 when generating
This commit is contained in:
		
							parent
							
								
									de69f9e9b6
								
							
						
					
					
						commit
						0a543a4f33
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		
							
								
								
									
										5
									
								
								index.js
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								index.js
									
										
									
									
									
								
							| 
						 | 
					@ -65,6 +65,11 @@ window.onload = () => {
 | 
				
			||||||
    document.getElementById('decrypted').innerHTML = output;
 | 
					    document.getElementById('decrypted').innerHTML = output;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  document.getElementById('padLength').oninput = (event) => {
 | 
				
			||||||
 | 
					    const value = parseInt(event.target.value);
 | 
				
			||||||
 | 
					    if (value < 1) event.target.value = 1;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  document.getElementById('generatePad').onclick = () => {
 | 
					  document.getElementById('generatePad').onclick = () => {
 | 
				
			||||||
    const input = parseInt(document.getElementById('padLength').value, 10);
 | 
					    const input = parseInt(document.getElementById('padLength').value, 10);
 | 
				
			||||||
    const output = generatePad(input);
 | 
					    const output = generatePad(input);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue