Action 'session' was not found on handler 'session'

Action 'session' was not found on handler 'session'

Can you show your code?



16.0k
edited Aug '14

My Form

<?php echo $this->getContent(); ?>
<div class="page-header">
    <h2>Register for INVO</h2>
</div>
   <form action='session/register' id='registerForm' class="form-horizontal" onbeforesubmit='return false;' >   

    <fieldset>

        <div class="control-group">
            <label class="control-label" for="username">Username</label>
            <div class="controls">
               <input type="text" class="input-xlarge" name="username" id="username">
                <p class="help-block">(required)</p>
                <div class="alert" id="username_alert">
                    <strong>Warning!</strong> Please enter your desired user name
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="email">Email Address</label>
            <div class="controls">
                <input type="text" class="input-xlarge" name="email" id="email">
                <p class="help-block">(required)</p>
                <div class="alert" id="email_alert">
                    <strong>Warning!</strong> Please enter your email
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="password">Password</label>
            <div class="controls">
                <input type="password" class="input-xlarge" name="password" id="password">
                <p class="help-block">(minimum 8 characters)</p>
                <div class="alert" id="password_alert">
                    <strong>Warning!</strong> Please provide a valid password
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="repeatPassword">Repeat Password</label>
            <div class="controls">
                <input type="password" class="input-xlarge" name="repeatPassword" id="repeatPassword">
                <div class="alert" id="repeatPassword_alert">
                    <strong>Warning!</strong> The password does not match
                </div>
            </div>
        </div>
        <p>By signing up, you accept terms of use and privacy policy.</p>
        <div class="form-actions">
            <input type="submit" class="btn btn-primary btn-large" value="Register">
        </div>
    </fieldset>
</form>

Action in Register

 public function registerAction()
    {
        // echo '<pre>'; print_r($this->request->getPost()); echo '</pre>';exit;         
        $request = $this->request;
        if ($request->isPost()) {

            $name = $request->getPost('name', array('string', 'striptags'));
            $username = $request->getPost('username', 'alphanum');
            $email = $request->getPost('email', 'email');
            $password = $request->getPost('password');
            $repeatPassword = $this->request->getPost('repeatPassword');

            if ($password != $repeatPassword) {
                $this->flash->error('Passwords are diferent');
                return false;
            }

            $user = new Users();
            $user->username = $username;
            $user->password = sha1($password);
            $user->name = $name;
            $user->email = $email;
            $user->created_at = new Phalcon\Db\RawValue('now()');
            $user->active = 'Y';
            if ($user->save() == false) {
                foreach ($user->getMessages() as $message) {
                    $this->flash->error((string) $message);
                }
            } else {
                Tag::setDefault('email', '');
                Tag::setDefault('password', '');
                $this->flash->success('Thanks for sign-up, please log-in to start generating invoices');
                return $this->forward('session/index');
            }
        }
    }