Skip to content

Commit

Permalink
Modify key model to make it more testable #109
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Feb 8, 2016
1 parent 751da08 commit b6b74b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion application/models/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ function __construct() {
*/
public function generate_key($user)
{
$finalKey = false;

do
{
// Generate a random salt
Expand All @@ -40,8 +42,10 @@ public function generate_key($user)
($this->insert($data) !== false
&& $this->affected_rows() === 1)){

return $new_key;
$finalKey = $new_key;
}

return $finalKey;
}

/**
Expand Down

0 comments on commit b6b74b5

Please sign in to comment.