Exemplo n.º 1
0
 public function _process()
 {
     appMakeTemplateReady($this->template);
     $v = new v6_validator($_POST, $this->template);
     $v->check_string('first_name', 'First Name', 2, 25, true);
     $v->check_string('last_name', 'Last Name', 2, 25, true);
     $v->check_email('email', 'E-Mail Address', true);
     $v->check_password('passwd', 'Password', 4, 20, true, false);
     if (empty($v->message) == false) {
         $this->template->message = 'Please fix input errors.';
         $this->template->show('signup.form');
     } else {
         if ($this->template->user->is_dupe_email($_POST['email']) == true) {
             $this->template->message = 'Please correct input errors below.';
             $this->template->email_hint = 'Account already exists with this email address.';
             $this->template->show('signup.form');
         } else {
             $this->template->user->first_name = $_POST['first_name'];
             $this->template->user->last_name = $_POST['last_name'];
             $this->template->user->email = strtolower($_POST['email']);
             $this->template->user->passwd = $_POST['passwd'];
             $this->template->user->save();
             $this->template->message = 'Account created successfully.  You may now login';
             $this->template->show('login.form');
         }
     }
 }
Exemplo n.º 2
0
 public function index()
 {
     // this is bit of a kludge in that since we are logging out, we don't want to make the template
     // ready, until AFTER the logout has occurred otherwise, menu options will still be created and displayed
     // as though the user is still logged in.... because technically he would be at that point.
     $mgr = new v6_manager();
     $mgr->logout();
     // now we can do everything we normally do...
     appMakeTemplateReady($this->template);
     $this->template->message = 'You have been logged out';
     $this->template->show('login.form');
 }
 public function index()
 {
     appMakeTemplateReady($this->template);
     // we have to make sure this url can be seen by this user!
     // he must be logged in and he must have the correct ACL table entries
     if ($this->template->mgr->UserIsLoggedIn(false) == false) {
         $this->template->message = 'You must be logged in to view this page';
         $this->template->show('login.form');
         // this shouldn't return
     } else {
         // I know it is the error template, but all I am doing is presenting the user with a message
         $this->template->title = 'Account Settings';
         $this->template->message = 'This is where the user could edit their password, etc if this were a real app';
         $this->template->show('error');
     }
 }
Exemplo n.º 4
0
 public function _process()
 {
     appMakeTemplateReady($this->template);
     $v = new v6_validator($_POST, $this->template);
     $v->check_email('email', 'E-Mail Address', true);
     $v->check_password('passwd', 'Password', 4, 20, true, false);
     if (empty($v->message) == false) {
         $this->template->message = 'Please fix input errors.';
         $this->template->show('login.form');
     } else {
         $acl = new v6_acl('users', 'email', 'passwd');
         if ($acl->authenticate($_POST['email'], $_POST['passwd']) == true) {
             $this->json['mgr_before'] = clone $this->template->mgr;
             // user provided good credentials
             $this->template->mgr->update($acl->user_table->id);
             header('location: /');
         } else {
             // user blew it
             $this->template->message = 'Login Failed';
             $this->template->show('login.form');
         }
     }
 }
Exemplo n.º 5
0
 public function index()
 {
     appMakeTemplateReady($this->template);
     // we have to make sure this url can be seen by this user!
     // he must be logged in and he must have the correct ACL table entries
     if ($this->template->mgr->UserIsLoggedIn(false) == false) {
         $this->template->message = 'You must be logged in to view this page';
         $this->template->show('login.form');
         // this shouldn't return
     } else {
         // we have to pass the user->id because mgr doesn't require acl to login each time
         if ($this->template->acl->has_access('testing', $this->template->user->id) == false) {
             $this->template->title = 'CONTENT RESTRICTED!';
             $this->template->message = 'You do not have sufficient rights to see this page!';
             $this->template->show('error');
         } else {
             // I know it is the error template, but all I am doing is presenting the user with a message
             $this->template->title = 'Congratulations!';
             $this->template->message = 'Only users with the correct ACL settings can see this!  Way to go!!!';
             $this->template->show('error');
         }
     }
 }
Exemplo n.º 6
0
 public function index()
 {
     appMakeTemplateReady($this->template);
     $this->template->show('index');
 }