From 47d2e4f2c0de6edb110cd9f3d1d235e71e93c52d Mon Sep 17 00:00:00 2001 From: keplyx Date: Mon, 26 Aug 2019 18:03:01 +0200 Subject: [PATCH] Secured website post request by password --- utils/NotificationsManager.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/NotificationsManager.js b/utils/NotificationsManager.js index 8ad7a51..90849a8 100644 --- a/utils/NotificationsManager.js +++ b/utils/NotificationsManager.js @@ -4,6 +4,7 @@ import * as Permissions from 'expo-permissions'; import {Notifications} from 'expo'; import AsyncStorageManager from "./AsyncStorageManager"; import LocaleManager from "./LocaleManager"; +import passwords from "../passwords"; const EXPO_TOKEN_SERVER = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/expo_notifications/save_token.php'; @@ -54,10 +55,8 @@ export default class NotificationsManager { */ static async scheduleNotification(title: string, body: string, time: number, data: Object, androidChannelID: string): Promise { await NotificationsManager.askPermissions(); - console.log(time); let date = new Date(); date.setTime(time); - console.log(date); return Notifications.scheduleLocalNotificationAsync( { title: title, @@ -116,6 +115,7 @@ export default class NotificationsManager { } let data = { function: 'get_machine_watchlist', + password: passwords.expoNotifications, token: token, }; fetch(EXPO_TOKEN_SERVER, { @@ -148,6 +148,7 @@ export default class NotificationsManager { } let data = { function: 'setup_machine_notification', + password: passwords.expoNotifications, locale: LocaleManager.getCurrentLocale(), token: token, machine_id: machineID, @@ -175,13 +176,13 @@ export default class NotificationsManager { * @param time */ static setMachineReminderNotificationTime(time: number) { - console.log(time); let token = AsyncStorageManager.getInstance().preferences.expoToken.current; if (token === '') { throw Error('Expo token not available'); } let data = { function: 'set_machine_reminder', + password: passwords.expoNotifications, token: token, time: time, };