You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					24 lines
				
				542 B
			
		
		
			
		
	
	
					24 lines
				
				542 B
			| 
								 
											2 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								use RobThree\Auth\TwoFactorAuth;
							 | 
						||
| 
								 | 
							
								require_once __DIR__ . "/../vendor/autoload.php";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if (isset($argv[1]) && isset($argv[2])) {
							 | 
						||
| 
								 | 
							
									$secret = $argv[1];
							 | 
						||
| 
								 | 
							
									$token = $argv[2];
							 | 
						||
| 
								 | 
							
								} elseif (isset($_GET["secret"]) && isset($_GET["token"])) {
							 | 
						||
| 
								 | 
							
									$secret = htmlspecialchars($_GET["secret"]);
							 | 
						||
| 
								 | 
							
									$token = htmlspecialchars($_GET["token"]);
							 | 
						||
| 
								 | 
							
								} else {
							 | 
						||
| 
								 | 
							
									echo "ERROR: Secret or Token is not set as argument!";
							 | 
						||
| 
								 | 
							
									exit();
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$tfa = new TwoFactorAuth("Hestia Control Panel");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Verify code
							 | 
						||
| 
								 | 
							
								$result = $tfa->verifyCode($secret, $token);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if ($result) {
							 | 
						||
| 
								 | 
							
									echo "ok";
							 | 
						||
| 
								 | 
							
								}
							 |