Skip to content

Commit

Permalink
Improve contact email #35
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Feb 3, 2016
1 parent b9f1525 commit c5918e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
12 changes: 3 additions & 9 deletions application/controllers/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ function login() {
}

echo json_encode($result);
}else{
echo "POST FAIL";
}

}
Expand Down Expand Up @@ -216,9 +214,6 @@ function signup() {
//Log the user will create his session and so on
$this->user->login($email, $password);

} else {

$result['success'] = false;
}

//The email is already in use
Expand Down Expand Up @@ -306,7 +301,8 @@ function resetPassword() {
function contact() {

if ($this->expectsPost(array('name', 'email', 'message'))) {
$result = array();

$result['success'] = false;

$name = $this->input->post('name');
$email = $this->input->post('email');
Expand Down Expand Up @@ -355,9 +351,7 @@ function contact() {

if ($mandrillResponse[0]['status'] === 'sent') {
$result['success'] = true;
} else {
$result['success'] = false;
}
}

echo json_encode($result);
}
Expand Down
14 changes: 14 additions & 0 deletions application/tests/controllers/Ajax_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,18 @@ public function test_resetPassword() {

$this->assertContains('true', $output);
}

public function test_contact(){
$output = $this->request(
'POST',
['Ajax', 'contact'],
[
'name' => 'Mathieu',
'email' => '[email protected]',
'message' => 'hello'
]
);

$this->assertContains('true', $output);
}
}

0 comments on commit c5918e1

Please sign in to comment.