Validation handler in configuration form

Created on 29 October 2019, over 5 years ago
Updated 26 April 2024, 12 months ago

 Motivation

The form fields server_key and sender_id of the configuration form have set the required property. But if you fill this fields with erroneous data the form save and responds "Ok". This can produce errors during the implementation of this module.

 Proposed resolution

FCM does not have a specific endpoint to ensure your server_key and your sender_id are working properly. Despite this fact, here I propose a workaround by sending a "fake request" to validate a "fake device token" and control de response.

If the server_key is not valid a form_state error message is thrown and the user is returned to the form without saving. This message points to the server_key if the return code is 401, and shows the specific error in other cases (p.e. server error).

In case of no error thrown the code is saved as usual.

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇪🇸Spain jginer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024