Esempio n. 1
0
 function register($app)
 {
     if ($this->config['registerActive']) {
         $app->get('/register', function ($request, $response, $args) {
             if ($this->auth) {
                 return $response->withStatus(200)->withHeader("Location", "/");
             } else {
                 return $this->view->render($response, 'register.html', ['auth' => $this->auth, 'user' => $this->user, 'regOpen' => true]);
             }
         })->setName('register');
         $app->post('/register', function ($request, $response, $args) {
             //var_dump($this->auth);
             if ($this->auth) {
                 return $response->withStatus(200)->withHeader("Location", "/");
             } else {
                 $user = new User_Controller();
                 $ret = $user->register($request, $response, $args);
                 //var_dump($ret);
                 return $this->view->render($response, 'register.html', ['auth' => $this->auth, 'user' => $this->user, 'regOpen' => true, 'error' => $ret['error'], 'success' => $ret['success']]);
             }
         })->setName('register');
     }
     return $app;
 }