Example #1
0
 /**
  * Sign up action
  *
  * @return CCResponse
  */
 public function action_sign_up()
 {
     // When the user is already authenticated we redirect him home.
     if (CCAuth::valid()) {
         return CCRedirect::to('/');
     }
     $this->theme->topic = __(':action.topic');
     $this->view = $this->theme->view('auth/sign_up.view');
     // create a new user object as data holder
     $user = new User();
     // bind the newly created user object to our view
     $this->view->bind('user', $user);
     if (CCIn::method('post')) {
         // Lets assign the email and the password to our
         // user object using the stirct assign method wich
         // will ignore all other post values in the assing process.
         $user->strict_assign(array('email', 'password'), CCIn::all('post'));
         $validator = CCValidator::post();
         // assign the labels to the validator this way we get
         // correct translated error messages.
         $validator->label(array('email' => __('model/user.label.email'), 'password' => __('model/user.label.password'), 'password_match' => __('model/user.label.password_match')));
         // does the user already exist
         $validator->set('same_email', User::find('email', $user->email));
         $validator->message(__(':action.message.email_in_use'), 'negative', 'same_email');
         // validate the other fields
         $validator->rules('email', 'required', 'email');
         $validator->rules('password', 'required', 'min:6');
         $validator->rules('password_match', 'required', 'match:password');
         // when the data passes the validation
         if ($validator->success()) {
             // because the user input is correct we can now save the
             // object to the database and sign the user in.
             $user->save();
             CCAuth::sign_in($user);
             UI\Alert::flash('success', __(':action.message.success'));
             return CCRedirect::to('/');
         } else {
             UI\Alert::add('danger', $validator->errors());
         }
     }
 }
Example #2
0
">PHP Info</a></li>
						</ul>
					</li>
					<?php 
}
?>
				</ul>
			</div><!-- /.navbar-collapse -->
			
		</div><!-- /.container-fluid -->
	</nav>
</div><!-- /#header -->

<div id="main-container" class="container">
	<?php 
echo UI\Alert::render();
?>
	<div>
		<?php 
if ($sidebar !== false) {
    ?>
		<div class="row">
			<div class="col-md-3">
				<?php 
    echo $sidebar;
    ?>
			</div>
			<div class="col-md-9">
				<?php 
    echo $content;
    ?>