Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ public function generateVoucher(){
}
}

public function generatePassword(){
return $this->_random_alpha_numeric();
public function generatePassword($length = 6){
return $this->_random_alpha_numeric($length);
}

public function generateUsernameForVoucher($prefix, $suffix){
Expand Down
4 changes: 3 additions & 1 deletion cake3/rd_cake/src/Controller/VouchersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ public function add(){
$s = $suffix;
}
$un = $this->VoucherGenerator->generateUsernameForVoucher($p,$s);
$pwd = $this->VoucherGenerator->generatePassword();
$pwd = array_key_exists('pwd_length',$this->request->data)
? $this->VoucherGenerator->generatePassword($this->request->data['pwd_length'])
: $this->VoucherGenerator->generatePassword();
$this->request->data['name'] = $un;
$this->request->data['password'] = $pwd;

Expand Down