Exemplo n.º 1
0
 public function oldPassword($field, $colum)
 {
     $passwdold = Authcomponent::password($field[$colum]);
     $row = $this->findById($this->data['User']['id']);
     if ($passwdold === $row['User']['passwd']) {
         return true;
     }
 }
Exemplo n.º 2
0
 public function oldPassword($field, $colum)
 {
     // $field = usersテーブルのpassword, $colum = passwordold
     $passwordold = Authcomponent::password($field[$colum]);
     // $passwordoldの暗号化
     $row = $this->findById($this->data['User']['id']);
     // usersテーブルのidを$rowに格納
     if ($passwordold === $row['User']['password']) {
         // $passwordoldとusersテーブルのpasswordを照合
         return true;
     }
 }
Exemplo n.º 3
0
 public function add($id)
 {
     if ($this->request->is('post')) {
         $this->Post->create();
         $this->request->data['Post']['topic_id'] = $id;
         $this->request->data['Post']['user_id'] = Authcomponent::user('id');
         if ($this->Post->save($this->request->data)) {
             $this->Session->setFlash('The post has been created!');
             $this->redirect('/topics/view/' . $id);
         }
     }
     $this->set('topics', $this->Post->Topic->find('list'));
 }
Exemplo n.º 4
0
 public function delete($id)
 {
     if (Authcomponent::user('role') == 1) {
         $this->redirect('index');
     }
     $this->Category->id = $id;
     if ($this->request->is(array('post', 'put'))) {
         //$this->Topic->id = $id;
         if ($this->Category->delete()) {
             $this->Session->setFlash('The category has been deleted!');
             $this->redirect(array('controller' => 'topics', 'action' => 'index'));
         }
     }
 }
Exemplo n.º 5
0
 public function delete($id)
 {
     if (Authcomponent::user('role') == 1) {
         $this->redirect('index');
     }
     $this->Topic->id = $id;
     if ($this->request->is(array('post', 'put'))) {
         //$this->Topic->id = $id;
         if ($this->Topic->delete()) {
             $this->Session->setFlash('The topic has been deleted!');
             $this->redirect('index');
         }
     }
     $this->set('categories', $this->Topic->Category->generateTreeList(null, null, null, '->'));
 }
Exemplo n.º 6
0
 /**
  * delete method
  *
  * @throws NotFoundException
  * @param string $id
  * @return void
  */
 public function delete($id = null)
 {
     if (Authcomponent::user('role') == 1) {
         $this->redirect(array('controller' => 'topics', 'action' => 'index'));
     }
     $this->User->id = $id;
     if (!$this->User->exists()) {
         throw new NotFoundException(__('Invalid user'));
     }
     $this->request->allowMethod('post', 'delete');
     if ($this->User->delete()) {
         $this->Session->setFlash(__('The user has been deleted.'));
     } else {
         $this->Session->setFlash(__('The user could not be deleted. Please, try again.'));
     }
     return $this->redirect(array('action' => 'index'));
 }