Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Controller_signUp extends Controller_Template {
- function action_index() {
- $this->template->title = 'Sign Up';
- $this->template->content = View::factory( 'signUp/index' );
- }
- function action_process() {
- $username = Input::post( 'username' );
- $password = Input::post( 'password' );
- $passwordRepeatedly = Input::post( 'passwordRepeatedly' );
- $email = Input::post( 'email' );
- $validation = Validation::factory();
- $validation
- ->add( 'username', 'username' )
- ->add_rule( 'required' )
- ->add_rule( 'max_length', 32 )
- ->add_rule( 'valid_string', array( 'alpha', 'numeric', 'punctuation', 'dashes' ) )
- ->add( 'password', 'password' )
- ->add_rule( 'required' )
- ->add_rule( 'min_length', 6 )
- ->add_rule( 'max_length', 255 )
- ->add( 'passwordRepeatedly', 'password (repeatedly)' )
- ->add_rule( 'required' )
- ->add_rule( 'match_value', 'password' )
- ->add( 'email', 'e-mail' )
- ->add_rule( 'required' )
- ->add_rule( 'valid_email' );
- if( $validation->run() ) {
- Session::set_flash( 'notification', 'You have been successfully signed-up! Thanks...' );
- Session::set_flash( 'location', 'sign-in' );
- $this->response->redirect( 'notification' );
- } else {
- Session::set_flash( 'error', 'There was something wrong with validation! Try again...' );
- $this->response->redirect( 'sign-up' );
- }
- }
- }
Add Comment
Please, Sign In to add comment