<?php 

defined( "DASHBOARD_MOD_DIR" ) OR DIE;

call_user_func(function() {
	
	$prefix = DB_TABLE_PREFIX;
	
	$status = false;
	
	$user = dashboard::fetch_assoc( "{$prefix}_users", $_POST['email'], 'email' );
	
	if( !$user ) {
		
		$message = "No account is linked to the given email";
		
	} else {
		
		$status = dashboard::call( 'email:send_reset_email', $user['email'] );
		
		if( $status ) {
			
			$message = "Please check your email for direction on how to reset your password";
			
		} else $message = "Sorry! A reset confirmation link could not be sent to the email";
		
	};
	
	uss::stop( $status, $message );
	
});

