JI-2081 Add translations

Move token verification to the individual integrations
Add error message to UI if logo validation fails
content-hub
Thomas Marstrander 2020-12-01 10:40:33 +01:00
parent 47d4499377
commit 1831312d41
No known key found for this signature in database
GPG Key ID: 59D7F1EC8B90E9A6
1 changed files with 12 additions and 11 deletions

View File

@ -3725,7 +3725,9 @@ class H5PCore {
'cancelPublishConfirmationDialogDescription' => $this->h5pF->t('Are you sure you want to cancel the sharing process?'),
'cancelPublishConfirmationDialogCancelButtonText' => $this->h5pF->t('No'),
'cancelPublishConfirmationDialogConfirmButtonText' => $this->h5pF->t('Yes'),
'add' => $this->h5pF->t('Add')
'add' => $this->h5pF->t('Add'),
'updateRegistrationOnHub' => $this->h5pF->t('Save account settings'),
'successfullyUpdated' => $this->h5pF->t('Your H5P Hub account settings have successfully been changed'),
);
}
@ -3931,22 +3933,13 @@ class H5PCore {
/**
* Register account
*
* @param string $token XSRF token
* @param array $formData Form data. Should include: name, email, description,
* contact_person, phone, address, city, zip, country, remove_logo
* @param object $logo Input image
*
* @return array
*/
public function hubRegisterAccount($token, $formData, $logo) {
if (!H5PCore::validToken('content_hub_registration', $token)) {
return [
'message' => 'Invalid token',
'status_code' => 401,
'error_code' => 'INVALID_TOKEN',
'success' => FALSE,
];
}
public function hubRegisterAccount($formData, $logo) {
$uuid = $this->h5pF->getOption('site_uuid', '');
if (empty($uuid)) {
@ -4007,6 +4000,14 @@ class H5PCore {
];
}
if (isset($results->errors->logo)) {
return [
'message' => $results->errors->logo[0],
'status_code' => 400,
'success' => FALSE,
];
}
if (
!isset($results->success)
|| $results->success === FALSE