예제 #1
0
 private function checkUser($id, $name)
 {
     Users::redirectIf(false);
     $users = Users::select()->where('id', $id)->andWhere('nickname', $name)->orWhere('user_key', $name)->get(0, 1);
     if (empty($users)) {
         Router::redirect('error.error404');
     }
     $user = $users[0];
     if (!Users::canUpdate($user)) {
         Router::redirect('home.index');
     }
     return $user;
 }
예제 #2
0
 public function newPassword()
 {
     Users::redirectIf(true);
     try {
         $user = Users::findOrFail('mail', Helper::post('mail'));
         $pass = Config::randomString(8);
         $user->password = password_hash($pass, PASSWORD_BCRYPT);
         $user->save();
         Users::resendPassword($user, $pass);
     } catch (\Exception $e) {
         Session::setFlash('danger', '', 'Aucun compte trouvée avec cette adresse email !');
     }
     Router::redirect('user.signin');
 }
예제 #3
0
 private function ajaxSub($id = 0)
 {
     Users::redirectIf(false);
     $member = Session::get('member');
     $project = Projects::findOrCreate('id', $id);
     if ($project->id == 0) {
         $dl = new \DateTime();
         $deadline = $dl->format('d/m/Y H:i');
         $url = Router::url('task:project.insert');
     } else {
         if ($project->id_leader != $member['id']) {
             return;
         }
         $dl = new \DateTime($project->deadline);
         $deadline = $dl->format('d/m/Y H:i');
         $url = Router::url('task:project.update', ['id' => $id]);
     }
     $this->set(['url' => $url, 'deadline' => explode(' ', $deadline), 'project' => $project]);
     $this->render('task/project_spec');
 }