Skip to content
Snippets Groups Projects
Commit 3021edaf authored by Marcus Johansson's avatar Marcus Johansson Committed by Marcus Johansson
Browse files

Issue #3489954: Unnecessary validation error

parent 82197107
No related branches found
No related tags found
1 merge request!12Issue #3489954: Unnecessary validation error
Pipeline #383861 passed
......@@ -98,6 +98,10 @@ class OpenAiConfigForm extends ConfigFormBase {
public function validateForm(array &$form, FormStateInterface $form_state) {
// Validate the api key against model listing.
$key = $form_state->getValue('api_key');
if (empty($key)) {
$form_state->setErrorByName('api_key', $this->t('The API Key is required.'));
return;
}
$api_key = $this->keyRepository->getKey($key)->getKeyValue();
if (!$api_key) {
$form_state->setErrorByName('api_key', $this->t('The API Key is invalid.'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment