fix handling of ?gender? during Character registration (fixes #154)

This commit is contained in:
oliver 2016-04-10 12:42:06 +02:00
parent 1925547cf4
commit 814b88c787

View file

@ -288,6 +288,7 @@
if($this->Characters->characterNameExists($charactername)) { if($this->Characters->characterNameExists($charactername)) {
$validation = $this->Validation->addValidationResult($validation, 'charactername', 'exist', true); $validation = $this->Validation->addValidationResult($validation, 'charactername', 'exist', true);
} }
$gender = $this->request->getPostParam('gender');
// Validate type // Validate type
$typeIndex = null; $typeIndex = null;
@ -303,7 +304,7 @@
} }
// Validate gender // Validate gender
if(is_null($gender) || !in_array(intval($gender), array(0, 1))) { if(is_null($gender) || ($gender !== "0" && $gender !== "1")) {
$validation = $this->Validation->addValidationResult($validation, 'gender', 'correct', false); $validation = $this->Validation->addValidationResult($validation, 'gender', 'correct', false);
} }
@ -335,7 +336,7 @@
$this->Auth->getUserId(), $this->Auth->getUserId(),
$types[$typeIndex]['id'], $types[$typeIndex]['id'],
$charactername, $charactername,
$gender intval($gender)
); );
$character = $this->Characters->getCharacterById( $character = $this->Characters->getCharacterById(
$characterId $characterId