app/Http/Controllers/Auth/AuthController.php
/**
	 * Handle a registration request for the application.
	 *
	 * @param  \Illuminate\Http\Request  $request
	 * @return \Illuminate\Http\Response
	 */
Handle a registration request for the application.
Handle a registration request for the application .
public function postRegister(Request $request)
	{
		$validator = $this->validator($request->all());
        if ($validator->fails()) {
            $this->throwValidationException(
                $request, $validator
            );
        }
		$activation_code 			= str_random(60) . $request->input('email');
		$user 						= new User;
		$user->name 				= $request->input('name');
		$user->empresa 				= $request->input('empresa');
		$user->first_name 			= $request->input('first_name');
		$user->last_name 			= $request->input('last_name');
		$user->email 				= $request->input('email');
		$user->password 			= bcrypt($request->input('password'));
		$user->activation_code 		= $activation_code;
		$userIpAddress 				= new CaptureIp;
		$user->signup_ip_address	= $userIpAddress->getClientIp();
		if ($user->save()) {
			$this->sendEmail($user);
	        $role = Role::find(4);
	        $role->users()->save($user);
            $profile = new Profile;
            $user->profile()->save($profile);
			return view('auth.activateAccount')->with('email', $request->input('email'));
		} else {
			\Session::flash('message', \Lang::get('notCreated') );
		}
	}
public function postRegister ( Request $ request ) { $ validator = $ this -> validator ( $ request -> all ( ) ) ; if ( $ validator -> fails ( ) ) { $ this -> throwValidationException ( $ request , $ validator ) ; } $ activation_code = str_random ( 60 ) . $ request -> input ( 'email' ) ; $ user = new User ; $ user -> name = $ request -> input ( 'name' ) ; $ user -> empresa = $ request -> input ( 'empresa' ) ; $ user -> first_name = $ request -> input ( 'first_name' ) ; $ user -> last_name = $ request -> input ( 'last_name' ) ; $ user -> email = $ request -> input ( 'email' ) ; $ user -> password = bcrypt ( $ request -> input ( 'password' ) ) ; $ user -> activation_code = $ activation_code ; $ userIpAddress = new CaptureIp ; $ user -> signup_ip_address = $ userIpAddress -> getClientIp ( ) ; if ( $ user -> save ( ) ) { $ this -> sendEmail ( $ user ) ; $ role = Role :: find ( 4 ) ; $ role -> users ( ) -> save ( $ user ) ; $ profile = new Profile ; $ user -> profile ( ) -> save ( $ profile ) ; return view ( 'auth.activateAccount' ) -> with ( 'email' , $ request -> input ( 'email' ) ) ; } else { \ Session :: flash ( 'message' , \ Lang :: get ( 'notCreated' ) ) ; } }
Handle a registration request for the application.
Handle a registration request for the application .
// DISABLED WHILE TESTING - Already disabled :) // if($this->captchaCheck() == false) // { //     return redirect()->back()->withErrors(['Sorry, Wrong Captcha'])->withInput(); // } // GET IP ADDRESS // $user_role = Role::whereName('usuario')->first();