1
0

Merge branch 'develop' of https://github.com/dev-fsociety/DFS-2016 into develop

This commit is contained in:
dibi
2016-12-02 00:58:50 +01:00
13 changed files with 341 additions and 195 deletions

@ -49,7 +49,7 @@ Router::scope('/', function (RouteBuilder $routes) {
* its action called 'display', and we pass a param to select the view file
* to use (in this case, src/Template/Pages/home.ctp)...
*/
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
$routes->connect('/', ['controller' => 'Users', 'action' => 'index']);
/**
* ...and connect the rest of 'Pages' controller's URLs.

@ -1,11 +1,11 @@
-- phpMyAdmin SQL Dump
-- version 4.6.5.1deb1
-- https://www.phpmyadmin.net/
-- version 4.2.12deb2+deb8u2
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Dec 01, 2016 at 09:45 PM
-- Server version: 5.6.30-1
-- PHP Version: 7.0.12-1
-- Host: localhost
-- Generation Time: Dec 01, 2016 at 10:56 PM
-- Server version: 5.5.53-0+deb8u1
-- PHP Version: 7.0.13-1~dotdeb+8.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
@ -14,7 +14,7 @@ SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `DFS-2016`
@ -26,12 +26,12 @@ SET time_zone = "+00:00";
-- Table structure for table `camps`
--
CREATE TABLE `camps` (
`id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `camps` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) COLLATE utf8_bin NOT NULL,
`lng` double NOT NULL,
`lat` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
@ -39,11 +39,11 @@ CREATE TABLE `camps` (
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) COLLATE utf8_bin NOT NULL,
`category_id` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'The parent category',
`camp_id` int(10) UNSIGNED NOT NULL
`category_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The parent category',
`camp_id` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
@ -52,12 +52,12 @@ CREATE TABLE `categories` (
-- Table structure for table `items`
--
CREATE TABLE `items` (
`id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `items` (
`id` int(10) unsigned NOT NULL,
`name` varchar(100) COLLATE utf8_bin NOT NULL,
`category_id` int(10) UNSIGNED NOT NULL,
`category_id` int(10) unsigned NOT NULL,
`description` text COLLATE utf8_bin NOT NULL,
`hot` int(10) UNSIGNED NOT NULL,
`hot` int(10) unsigned NOT NULL,
`cooldown` int(11) NOT NULL COMMENT 'Number of days'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -67,10 +67,10 @@ CREATE TABLE `items` (
-- Table structure for table `needs`
--
CREATE TABLE `needs` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL COMMENT 'Refugee',
`item_id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `needs` (
`id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL COMMENT 'Refugee',
`item_id` int(10) unsigned NOT NULL,
`created` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -80,10 +80,10 @@ CREATE TABLE `needs` (
-- Table structure for table `offers`
--
CREATE TABLE `offers` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL COMMENT 'Donor',
`item_id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `offers` (
`id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL COMMENT 'Donor',
`item_id` int(10) unsigned NOT NULL,
`created` date NOT NULL,
`event_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -94,11 +94,11 @@ CREATE TABLE `offers` (
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `posts` (
`id` int(10) unsigned NOT NULL,
`title` varchar(255) COLLATE utf8_bin NOT NULL,
`body` text COLLATE utf8_bin NOT NULL,
`category_id` int(10) UNSIGNED NOT NULL DEFAULT '0'
`category_id` int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------
@ -107,8 +107,8 @@ CREATE TABLE `posts` (
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`password` varchar(255) COLLATE utf8_bin NOT NULL,
`role` int(11) NOT NULL COMMENT '0=Orga; 1=Donor; 2=refugee',
@ -117,16 +117,9 @@ CREATE TABLE `users` (
`email` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`phone` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`description` text COLLATE utf8_bin,
`created` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `role`, `firstname`, `name`, `email`, `phone`, `description`, `created`) VALUES
(9, 'MSF', '$2y$10$2yDqxbHOB2.5fnOPHT50xOQgFIo1js5ewuppPuSq/IInvuRrwLyFq', 0, '', '', '', '', '', '2016-12-01'),
(10, 'test', '$2y$10$PUOW4Ew6LcMSm3l/o/i//OhV6MgMcumCSJ4NJHC5uMF61QLXPVRSG', 0, '', '', 'caca@gmail.com', '', '', '2016-12-01');
`created` date DEFAULT NULL,
`camps_id` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Indexes for dumped tables
@ -136,43 +129,43 @@ INSERT INTO `users` (`id`, `username`, `password`, `role`, `firstname`, `name`,
-- Indexes for table `camps`
--
ALTER TABLE `camps`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `items`
--
ALTER TABLE `items`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `needs`
--
ALTER TABLE `needs`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `offers`
--
ALTER TABLE `offers`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
@ -182,37 +175,37 @@ ALTER TABLE `users`
-- AUTO_INCREMENT for table `camps`
--
ALTER TABLE `camps`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `needs`
--
ALTER TABLE `needs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `offers`
--
ALTER TABLE `offers`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

@ -1,65 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 4.6.4deb1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Dec 01, 2016 at 01:24 PM
-- Server version: 5.7.16-0ubuntu0.16.10.1
-- PHP Version: 7.0.8-3ubuntu3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `dfs_2016`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE `users`;
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`password` varchar(255) COLLATE utf8_bin NOT NULL,
`role` int(11) NOT NULL COMMENT '0=Orga; 1=Donor; 2=refugee',
`firstname` varchar(100) COLLATE utf8_bin NOT NULL,
`name` varchar(100) COLLATE utf8_bin NOT NULL,
`email` varchar(255) COLLATE utf8_bin NOT NULL,
`phone` varchar(20) COLLATE utf8_bin NOT NULL,
`description` text COLLATE utf8_bin NOT NULL,
`created` date NOT NULL,
`camp_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

@ -14,8 +14,8 @@
*/
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;
use Cake\Controller\Controller;
/**
* Application Controller
@ -44,6 +44,36 @@ class AppController extends Controller
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
$this->loadComponent('Security');
$this->loadComponent('Auth', [
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'username',
'password' => 'password'
]
]
],
'authorize' => 'Controller',
'loginAction' => [
'controller' => 'Users',
'action' => 'login'
],
'loginRedirect' => [
'controller' => 'Categories',
'action' => 'index'
],
'logoutRedirect' => [
'controller' => 'Users',
'action' => 'login'
]
]);
$this->Auth->deny();
}
public function isAuthorized($user)
{
return isset($user);
}
/**
@ -59,5 +89,8 @@ class AppController extends Controller
) {
$this->set('_serialize', true);
}
if(isset($this->Auth))
$this->set('loggedUser', $this->Auth->user());
}
}

@ -18,11 +18,6 @@ class ItemsController extends AppController
*/
public function index()
{
/* $this->paginate = [
'contain' => ['Categories'],
'order' => ['Items.shot' => 'desc']
];*/
//$items = $this->paginate($this->Items->find()->where(['id' => 1])->toArray());
$items = $this->paginate($this->Items->find()->order(['hot' => 'DESC']));
$this->set(compact('items'));
@ -127,7 +122,8 @@ class ItemsController extends AppController
$items = $this->Items->find('category', [
'category_id' => $category_id
]);
$this->set(compact('items'));
$category = $this->Items->Categories->get($category_id);
$this->set(compact('items', 'category'));
}

@ -1,6 +1,7 @@
<?php
namespace App\Controller;
use Cake\Event\Event;
use App\Controller\AppController;
/**
@ -46,11 +47,18 @@ class UsersController extends AppController
*
* @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
*/
public function add()
public function subscribeRefugee()
{
$user = $this->Users->newEntity();
if ($this->request->is('post')) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user->role = 2;
$user->firstname = null;
$user->name = null;
$user->email = null;
$user->phone = null;
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
@ -59,9 +67,68 @@ class UsersController extends AppController
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$user->role = 2;
$camps = $this->Users->Camps->find('list', ['limit' => 200]);
$this->set(compact('user','camps'));
}
public function subscribeDonor()
{
$user = $this->Users->newEntity();
if ($this->request->is('post')) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user->role = 1;
if($user->firstname == null || $user->name == null || $user->email == null || $user->phone == null)
{
$this->Flash->error(__('The user could not be saved. You\'ve forgotten to fill in some fields.'));
return $this->redirect(['action' => 'subscribeDonor']);
}
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$user->role = 1;
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}
public function subscribeOrganisation()
{
$user = $this->Users->newEntity();
if ($this->request->is('post')) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user->role = 0;
if($user->firstname == null || $user->email == null || $user->phone == null)
{
$this->Flash->error(__('The user could not be saved. You\'ve forgotten to fill in some fields.'));
return $this->redirect(['action' => 'subscribeOrganisation']);
}
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$user->role = 0;
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}
@ -72,13 +139,17 @@ class UsersController extends AppController
* @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
public function editRefugee($id = null)
{
$user = $this->Users->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user->role = 2;
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
@ -87,10 +158,78 @@ class UsersController extends AppController
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$user->role = 2;
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}
public function editDonor($id = null)
{
$user = $this->Users->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user->role = 1;
if($user->firstname == null || $user->name == null || $user->email == null || $user->phone == null)
{
$this->Flash->error(__('The user could not be saved. You\'ve forgotten to fill in some fields.'));
return $this->redirect(['action' => 'editDonor', $id]);
}
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$user->role = 1;
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}
public function editOrganisation($id = null)
{
$user = $this->Users->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user->role = 0;
if($user->firstname == null || $user->email == null || $user->phone == null)
{
$this->Flash->error(__('The user could not be saved. You\'ve forgotten to fill in some fields.'));
return $this->redirect(['action' => 'editOrganisation', $id]);
}
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$user->role = 0;
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}
/**
* Delete method
*
@ -110,4 +249,57 @@ class UsersController extends AppController
return $this->redirect(['action' => 'index']);
}
public function login()
{
if($this->request->is('post'))
{
$user = $this->Auth->identify();
if($user)
{
$this->Auth->setUser($user);
$this->Flash->success('Your are now logged in.');
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error('Your username or password is incorrect.');
}
}
public function initialize()
{
parent::initialize();
$this->Auth->allow(['logout', 'subscribeRefugee', 'subscribeDonor']);
}
public function isAuthorized($user)
{
if(isset($user))
{
if(in_array($this->request->action, ['edit', 'delete', 'view']))
{
if((int)$this->request->params['pass'][0] === $user['id'])
{
return true;
}
}
}
return parent::isAuthorized($user);
}
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->Auth->allow(['logout', 'subscribeRefugee', 'subscribeDonor']);
}
public function logout()
{
$this->Flash->success('You are now logged out.');
$this->redirect($this->Auth->logout());
}
}

@ -1,6 +1,7 @@
<?php
namespace App\Model\Entity;
use Cake\Auth\DefaultPasswordHasher;
use Cake\ORM\Entity;
/**
@ -45,4 +46,12 @@ class User extends Entity
protected $_hidden = [
'password'
];
protected function _setPassword($password)
{
if(strlen($password) > 0)
{
return (new DefaultPasswordHasher)->hash($password);
}
}
}

@ -80,24 +80,24 @@ class UsersTable extends Table
$validator
->requirePresence('firstname', 'create')
->notEmpty('firstname');
->allowEmpty('firstname');
$validator
->requirePresence('name', 'create')
->notEmpty('name');
->allowEmpty('name');
$validator
->email('email')
->requirePresence('email', 'create')
->notEmpty('email');
->allowEmpty('email');
$validator
->requirePresence('phone', 'create')
->notEmpty('phone');
->allowEmpty('phone');
$validator
->requirePresence('description', 'create')
->notEmpty('description');
->allowEmpty('description');
return $validator;
}

@ -1,5 +1,8 @@
<?php
debug($category);
foreach ($items as $item) {
debug($item);
}

@ -2,41 +2,32 @@
<div class="medium-6 medium-centered large-4 large-centered columns">
<!-- Log In section -->
<form>
<div class="row column log-in-form" style="padding:1rem; margin-bottom: 10px; margin-top: 10px;">
<?= $this->Form->create($user) ?>
<fieldset>
<h4 class="text-center"> Log In </h4>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
?>
<p>
<a type="submit" class="button expanded">
<?= $this->Form->button(__('Log In')) ?>
</a>
</p>
<?= $this->Form->end() ?>
<p class="text-center"><a href="#"></a></p>
</div>
</form>
<div class="row column log-in-form" style="padding:1rem; margin-bottom: 10px; margin-top: 10px;">
<?= $this->Form->create() ?>
<fieldset>
<h4 class="text-center"> Log In </h4>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
?>
<p>
<a type="submit" class="button expanded">
<?= $this->Form->button(__('Log In')) ?>
</a>
</p>
<?= $this->Form->end() ?>
<p class="text-center"><a href="#"></a></p>
</div>
<!-- Sign Up section -->
<form>
<div class="row column log-in-form">
<h4 class="text-center">Sign up as</h4>
<center>
<a type="submit" class="button">
<?= $this->Form->button(__('Refugee')) ?>
</a>
<a type="submit" class="button">
<?= $this->Form->button(__('Donor')) ?>
</a>
</center>
</div>
</form>
<!-- Sign Up section -->
<div class="row column log-in-form">
<h4 class="text-center">Sign up as</h4>
<center>
<?= $this->Html->link(__('Refugee'), ['controller' => 'Users', 'action' => 'subscribeRefugee'], ['class' => 'linkSubscribe']) ?>
<?= $this->Html->link(__('Donor'), ['controller' => 'Users', 'action' => 'subscribeDonor'], ['class' => 'linkSubscribe']) ?>
</center>
</div>
</div>
</div>

@ -1,19 +1,17 @@
<div class="log-in-form medium-6 medium-centered large-4 large-centered columns">
<div class="log-in-form medium-6 medium-centered large-4 large-centered columns">
<?= $this->Form->create($user) ?>
<fieldset>
<h4 class="text-center"> Register as donor </h4>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->input('firstname');
echo $this->Form->input('name');
echo $this->Form->input('email');
echo $this->Form->input('phone');
echo $this->Form->input('description', ['required'=>false]);
echo $this->Form->input('firstname', ['required' => true]);
echo $this->Form->input('name', ['required' => true]);
echo $this->Form->input('email', ['required' => true]);
echo $this->Form->input('phone', ['required' => true]);
echo $this->Form->input('description', ['required' => false]);
?>
</fieldset>
<a type="submit" class="button expanded">
<?= $this->Form->button(__('Submit')) ?>
</a>
<?= $this->Form->submit(__('Submit'), ['class' => 'button']) ?>
<?= $this->Form->end() ?>
</div>
</div>

@ -1,4 +1,4 @@
<div class="log-in-form medium-6 medium-centered large-4 large-centered columns">
<div class="log-in-form medium-6 medium-centered large-4 large-centered columns">
<?= $this->Form->create($user) ?>
<fieldset>
<h4 class="text-center"> Register an organisation </h4>
@ -12,8 +12,6 @@
echo $this->Form->input('description',['required'=>false]);
?>
</fieldset>
<a type="submit" class="button expanded">
<?= $this->Form->button(__('Submit')) ?>
</a>
<?= $this->Form->submit(__('Submit'), ['class' => 'button']) ?>
<?= $this->Form->end() ?>
</div>
</div>

@ -1,19 +1,17 @@
<div class="log-in-form medium-6 medium-centered large-4 large-centered columns">
<div class="log-in-form medium-6 medium-centered large-4 large-centered columns">
<?= $this->Form->create($user) ?>
<fieldset>
<h4 class="text-center"> Register </h4>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->input('firstname', ['required'=>false]);
echo $this->Form->input('name');
echo $this->Form->input('email', ['required'=>false]);
echo $this->Form->input('phone', ['required'=>false]);
echo $this->Form->input('description',['required'=>false]);
echo $this->Form->input('firstname', ['type' => 'hidden']);
echo $this->Form->input('name', ['type' => 'hidden']);
echo $this->Form->input('email', ['type' => 'hidden']);
echo $this->Form->input('phone', ['type' => 'hidden']);
echo $this->Form->input('description', ['type' => 'hidden']);
?>
</fieldset>
<a type="submit" class="button expanded">
<?= $this->Form->button(__('Submit')) ?>
</a>
<?= $this->Form->submit(__('Submit'), ['class' => 'button']) ?>
<?= $this->Form->end() ?>
</div>
</div>