Ivan - Add name to user bean [skip ci]

This commit is contained in:
ivan 2016-07-27 00:50:20 -03:00
parent 3f01526814
commit e0dd5cbf39
2 changed files with 8 additions and 3 deletions

View File

@ -6,6 +6,7 @@ class SignUpController extends Controller {
const PATH = '/signup';
private $userEmail;
private $userName;
private $userPassword;
public function validations() {
@ -29,7 +30,7 @@ class SignUpController extends Controller {
}
public function handler() {
$this->setRequestData();
$this->storeRequestData();
try {
$userId = $this->createNewUserAndRetrieveId();
@ -45,7 +46,8 @@ class SignUpController extends Controller {
}
public function setRequestData() {
public function storeRequestData() {
$this->userName = Controller::request('name');
$this->userEmail = Controller::request('email');
$this->userPassword = Controller::request('password');
}
@ -54,6 +56,7 @@ class SignUpController extends Controller {
$userInstance = new User();
$userInstance->setProperties([
'name' => $this->userName,
'email' => $this->userEmail,
'password' => Hashing::hashPassword($this->userPassword)
]);
@ -65,7 +68,8 @@ class SignUpController extends Controller {
$mailSender = new MailSender();
$mailSender->setTemplate(MailTemplate::USER_SIGNUP, [
'to' => $this->userEmail
'to' => $this->userEmail,
'name' => $this->userName
]);
$mailSender->send();

View File

@ -9,6 +9,7 @@ describe '/user/signup' do
userRow = $database.getRow('user', response['data']['userId'])
(userRow['email']).should.equal('steve@jobs.com')
(userRow['name']).should.equal('Steve Jobs')
end
it 'should fail if name is invalid' do