<?php

namespace WpBookingProFrontend\app\controllers;

use WpBookingPro\Factory;
use WpBookingPro\Filesystem\Support\StringController;
use WpBookingPro\Mvc\Controller\ControllerFrontend;
use WpBookingPro\Mvc\Model\Model;
use WpBookingPro\Utilities\Utility;
use WpBookingProFrontend\app\helpers\ConfigHelper;
use WpBookingProFrontend\app\helpers\EmailHelper;

defined('_WPBOOKINGPRO_EXEC') or die;

/**
 * Class BlockController
 */
class LoginController extends ControllerFrontend
{
    public function programmatic_login(){
        $input = Factory::getInput();
        $data =  $input->getData();
        $link_redirect_error = isset($data['link_redirect_error'])?$data['link_redirect_error']:'';
        $link_redirect_success = isset($data['link_redirect_success'])?$data['link_redirect_success']:'';
        $modelLogin = Model::getInstance('login');
        $check = $modelLogin->programmaticLogin($data);
        if($check == false) {
            Utility::redirect($link_redirect_error.'/?login_message=error');
        } else {
            Utility::redirect($link_redirect_success);
        }
    }

}
