Fixes for contact password not sticking on update

This commit is contained in:
David Bomba 2020-09-12 19:53:28 +10:00
parent dcaaa53ae6
commit 89dcd43e47
4 changed files with 14 additions and 7 deletions

View File

@ -81,6 +81,9 @@ class UpdateClientRequest extends Request
'email' => ctrans('validation.email', ['attribute' => 'email']),
'name.required' => ctrans('validation.required', ['attribute' => 'name']),
'required' => ctrans('validation.required', ['attribute' => 'email']),
'contacts.*.password.min' => ctrans('texts.password_strength'),
'contacts.*.password.regex' => ctrans('texts.password_strength'),
'contacts.*.password.string' => ctrans('texts.password_strength'),
];
}
@ -109,11 +112,12 @@ class UpdateClientRequest extends Request
if (strlen($contact['password']) == 0) {
$input['contacts'][$key]['password'] = '';
} else {
$contact['password'] = str_replace('*', '', $contact['password']);
$input['contacts'][$key]['password'] = str_replace('*', '', $contact['password']);
if (strlen($contact['password']) == 0) {
unset($input['contacts'][$key]['password']);
}
}
}
}

View File

@ -58,12 +58,10 @@ class ClientContactRepository extends BaseRepository
$update_contact->fill($contact);
if (array_key_exists('password', $contact)) {
if (strlen($contact['password']) == 0) {
$update_contact->password = '';
} else {
$update_contact->password = Hash::make($contact['password']);
}
if (array_key_exists('password', $contact) && strlen($contact['password']) > 1) {
$update_contact->password = Hash::make($contact['password']);
}
$update_contact->save();

View File

@ -66,6 +66,10 @@ class AddIsPublicToDocumentsTable extends Migration
Schema::table('companies', function ($table) {
$table->enum('default_auto_bill', ['off', 'always', 'optin', 'optout'])->default('off');
});
Schema::table('recurring_invoices', function (Blueprint $table) {
$table->integer('remaining_cycles')->nullable()->change();
});
}
/**

View File

@ -3269,4 +3269,5 @@ return [
'payment_due' => 'Payment due',
'account_balance' => 'Account balance',
'password_strength' => 'Password strength too weak',
];