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.
		
		
		
		
		
			
		
			
				
					
					
						
							40 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							40 lines
						
					
					
						
							1.2 KiB
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								use App\Enumerators\SessionElement;
							 | 
						|
								use App\Wrappers\CAPTCHAWrapper;
							 | 
						|
								use App\Wrappers\DatabaseInteractions;
							 | 
						|
								use App\Wrappers\SessionWrapper;
							 | 
						|
								use App\Wrappers\SQLQueryBuilderWrapper;
							 | 
						|
								use Ramsey\Uuid\Uuid;
							 | 
						|
								
							 | 
						|
								require_once __DIR__ . "/../../vendor/autoload.php";
							 | 
						|
								
							 | 
						|
								require_once __DIR__ . "/../../vendor/autoload.php";
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								$captchaResponse = $_POST['g-recaptcha-response'];
							 | 
						|
								CAPTCHAWrapper::HandleCaptchaResponse($captchaResponse);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								if(!isset($_POST['Password1'])) die('No password');
							 | 
						|
								if(!isset($_POST['Password2'])) die('No confirm password');
							 | 
						|
								
							 | 
						|
								if($_POST['Password1'] != $_POST['Password2']) die('Passwords do not match');
							 | 
						|
								
							 | 
						|
								$sha512Hash = hash(algo: 'sha512', data: $_POST['Password1'], binary: false);
							 | 
						|
								$hashedPassword = password_hash(password: $sha512Hash, algo: PASSWORD_BCRYPT);
							 | 
						|
								
							 | 
						|
								$db = new DatabaseInteractions();
							 | 
						|
								
							 | 
						|
								$db->RunUpdate(
							 | 
						|
								    queryBuilder: SQLQueryBuilderWrapper::UPDATE(
							 | 
						|
								        table: 'Users',
							 | 
						|
								    )
							 | 
						|
								        ->set(col: 'PasswordHash', value: ':__password_hash__')
							 | 
						|
								        ->where('ID=:__user_id__')
							 | 
						|
								        ->bindValue(name: '__user_id__', value: SessionWrapper::Get(SessionElement::USER_ID))
							 | 
						|
								        ->bindValue(name: '__password_hash__', value: $hashedPassword)
							 | 
						|
								);
							 | 
						|
								
							 | 
						|
								header("Location: /profile");
							 | 
						|
								die();
							 | 
						|
								
							 |