<commit_before><?php

Class LoginController extends AdminBaseController {

	public function getIndex()
	{
		return View::make('user.login');
	}

	public function postLogin()
	{
		if(Auth::attempt([
					'uname'		=>		Input::get('uname'),
					'password'	=>		Input::get('<PASSWORD>'),
					'is_admin'	=>		0
			]) )
			return Redirect::intended('user-panel');

		Session::flash('error', "Invalid Credentials");
		return Redirect::back()->withInput();
	}

	public function getAdmin()
	{
		return View::make('admin.login');
	}

	public function postAdmin()
	{
		if( Auth::attempt([
				   'uname'	=>	Input::get('uname'),
				'password'	=>	Input::<PASSWORD>('<PASSWORD>'),
				'is_admin'	=>	1
			]) )
			return Redirect::intended('admin-panel');

		Session::flash('error', "Invalid Username/Password");
		return Redirect::back()->withInput();
	}<commit_msg>Added self registration methods to LoginController<commit_after><?php

Class LoginController extends AdminBaseController {

	public function getIndex()
	{
		return View::make('user.login');
	}

	public function postLogin()
	{
		if(Auth::attempt([
					'uname'		=>		Input::get('uname'),
					'password'	=>		Input::get('<PASSWORD>'),
					'is_admin'	=>		0
			]) )
			return Redirect::intended('user-panel');

		Session::flash('error', "Invalid Credentials");
		return Redirect::back()->withInput();
	}

	public function getAdmin()
	{
		return View::make('admin.login');
	}

	public function postAdmin()
	{
		if( Auth::attempt([
				   'uname'	=>	Input::get('uname'),
				'password'	=>	Input::get('<PASSWORD>'),
				'is_admin'	=>	1
			]) )
			return Redirect::intended('admin-panel');

		Session::flash('error', "Invalid Username/Password");
		return Redirect::back()->withInput();
	}

	public function getSelfRegister()
	{
		$settings = GeneralSettings::first();

		if( ! $settings->self_signup ) {
			$this->notifyError("Self Signup Not Allowed.");
			return Redirect::route('user-panel');
		}
		return View::make('user.self-registration');
	}

	public function postSelfRegister()
	{
		$input = Input::only('uname','pword','pword_confirmation','status',
							'fname','lname','email','address','contact');
		$rules = Config::get('validations.accounts');
		$rules['uname'][] = 'unique:user_accounts';
		$rules['pword'][] = 'confirmed';

		$v = Validator::make($input, $rules);
		$v->setAttributeNames(Config::get('attributes.accounts') );

		if( $v->fails() )
			return Redirect::back()
							->withInput()
							->withErrors($v)
							;

		$input['plan_type'] 	= PREPAID_PLAN;
		$input['clear_pword']	= $input['pword'];
		$input['pword']			= Hash::make($input['pword']);
		$input['is_admin']		= 0;

		if( Subscriber::create($input) ) {
			Session::flash('success','succeed');
		}

		return Redirect::back();
	}
{'fraction_non_alphanumeric': 0.2015195369030391, 'fraction_numerical': 0.001808972503617945, 'mean_word_length': 4.552208835341365, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '813846', 'n_tokens_mistral': 1087, 'n_tokens_neox': 931, 'n_words': 155}