<commit_before><?php defined('SYSPATH') or die('No direct script access.');

class Controller_Login_Login extends Controller_Base {

    public function before()
    {   
        $this->template = 'templates/login';

        parent::before();

        $this->template->loc_styles = ['/media/css/login/login.css'=>'screen',
                                       '/media/css/bootstrap_validator/formValidation.css'=>'screen'];

        $this->template->loc_scripts = ['/media/js/bootstrap_validator/dist/formValidation.js',
                                        '/media/js/bootstrap_validator/dist/bootstrap.js',
                                        '/media/js/login/login.js'];

        $this->template->body = View::factory('login/login');
    }
    
    public function action_index()
    {
        if (HTTP_Request::POST == $this->request->method()) 
        {
            $post = $this->request->post();
            $user = Auth::instance()->login($post['username'], $post['password']);

            if ($user)
            {
                $this->request->redirect('dashboard');
            }

            $message = 'Login failed';
        }
    }

    public function action_signup()
    {
        die;
        $username = $message = $errors = $email = NULL;

        if (HTTP_Request::POST == $this->request->method()) 
        {
            $username = $this->request->post('username');

            try
            {
                $user = new Model_User;

                $user->create_user($this->request->post(), array( 'username', 'password', 'full_name'));

                $user->add('roles', ORM::factory('Role', array('name' => 'login')));

                $message = $user->full_name.' has been successfully created. Please contact your administrator to activate your account.';
                $this->template->body->set('message', $message);

            }
            catch (ORM_Validation_Exception $e) 
            { 
                $message = 'There were errors.';
                $errors = $e->errors('models');
                echo json_encode($errors);
            }
            catch (Exception $error)
            {
                $message = 'The following errors occured';
                $errors = $error->getMessage();
                echo json_encode($errors);
            }
        }

        $this->template->body
               ->bind('message', $message)
               ->bind('errors', $errors)
               ->bind('username', $username);

    }

    public function action_logout()
    {
        Auth::instance()->logout();
        $this->request->redirect('login');
    }
    
} // End of class<commit_msg>Arranged js file structure<commit_after><?php defined('SYSPATH') or die('No direct script access.');

class Controller_Login_Login extends Controller_Base {

    public function before()
    {   
        $this->template = 'templates/login';

        parent::before();

        $this->template->loc_styles = ['/media/css/login/login.css'=>'screen',
                                       '/media/css/bootstrap_validator/formValidation.css'=>'screen'];

        $this->template->loc_scripts = ['/media/js/bootstrap_validator/dist/formValidation.js',
                                        '/media/js/bootstrap_validator/dist/bootstrap.js',
                                        '/media/js/login/login.js',
                                        '/media/js/validation/login/login.js'];

        $this->template->body = View::factory('login/login');
    }
    
    public function action_index()
    {
        if (HTTP_Request::POST == $this->request->method()) 
        {
            $post = $this->request->post();
            $user = Auth::instance()->login($post['username'], $post['password']);

            if ($user)
            {
                $this->request->redirect('dashboard');
            }

            $message = 'Login failed';
        }
    }

    public function action_signup()
    {
        die;
        $username = $message = $errors = $email = NULL;

        if (HTTP_Request::POST == $this->request->method()) 
        {
            $username = $this->request->post('username');

            try
            {
                $user = new Model_User;

                $user->create_user($this->request->post(), array( 'username', 'password', 'full_name'));

                $user->add('roles', ORM::factory('Role', array('name' => 'login')));

                $message = $user->full_name.' has been successfully created. Please contact your administrator to activate your account.';
                $this->template->body->set('message', $message);

            }
            catch (ORM_Validation_Exception $e) 
            { 
                $message = 'There were errors.';
                $errors = $e->errors('models');
                echo json_encode($errors);
            }
            catch (Exception $error)
            {
                $message = 'The following errors occured';
                $errors = $error->getMessage();
                echo json_encode($errors);
            }
        }

        $this->template->body
               ->bind('message', $message)
               ->bind('errors', $errors)
               ->bind('username', $username);

    }

    public function action_logout()
    {
        Auth::instance()->logout();
        $this->request->redirect('login');
    }
    
} // End of class
{'fraction_non_alphanumeric': 0.15186829448760636, 'fraction_numerical': 0.0, 'mean_word_length': 1.6414264777723497, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1553062', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1338, 'n_words': 251}