Example #1
0
 /**
  * Register the user and start a session
  */
 public function register()
 {
     $fullName = Input::get('fullName');
     $email = Input::get('email');
     $password = Input::get('password');
     // lets validate the users input
     $validator = Validator::make(array('fullName' => $fullName, 'email' => $email, 'password' => $password), array('fullName' => 'required', 'email' => 'required|email|unique:users', 'password' => 'required|min:8'));
     // Commented out for open beta and beyond
     /************* Make sure the email being used has been invited to beta
              *
     		if ( !DB::table('beta')->whereEmail($email)->whereStatus(1)->get() ) {
     			$validator->getMessageBag()->add('used', 'The email used has not been invited.');
     			return Redirect::back()->withErrors($validator)->withInput();
     		}
              *
              ******************/
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $user = new User();
     $user->full_name = $fullName;
     $user->email = $email;
     $user->password = Hash::make($password);
     $user->save();
     if (Auth::attempt(array('email' => $email, 'password' => $password))) {
         Helpers::sendWelcomeMail();
         return Redirect::to('hud');
     }
     return Redirect::back()->withErrors($validator);
 }