Browse Source

Secured website post request by password

keplyx 4 years ago
parent
commit
47d2e4f2c0
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      utils/NotificationsManager.js

+ 4
- 3
utils/NotificationsManager.js View File

@@ -4,6 +4,7 @@ import * as Permissions from 'expo-permissions';
4 4
 import {Notifications} from 'expo';
5 5
 import AsyncStorageManager from "./AsyncStorageManager";
6 6
 import LocaleManager from "./LocaleManager";
7
+import passwords from "../passwords";
7 8
 
8 9
 const EXPO_TOKEN_SERVER = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/expo_notifications/save_token.php';
9 10
 
@@ -54,10 +55,8 @@ export default class NotificationsManager {
54 55
      */
55 56
     static async scheduleNotification(title: string, body: string, time: number, data: Object, androidChannelID: string): Promise<string> {
56 57
         await NotificationsManager.askPermissions();
57
-        console.log(time);
58 58
         let date = new Date();
59 59
         date.setTime(time);
60
-        console.log(date);
61 60
         return Notifications.scheduleLocalNotificationAsync(
62 61
             {
63 62
                 title: title,
@@ -116,6 +115,7 @@ export default class NotificationsManager {
116 115
         }
117 116
         let data = {
118 117
             function: 'get_machine_watchlist',
118
+            password: passwords.expoNotifications,
119 119
             token: token,
120 120
         };
121 121
         fetch(EXPO_TOKEN_SERVER, {
@@ -148,6 +148,7 @@ export default class NotificationsManager {
148 148
         }
149 149
         let data = {
150 150
             function: 'setup_machine_notification',
151
+            password: passwords.expoNotifications,
151 152
             locale: LocaleManager.getCurrentLocale(),
152 153
             token: token,
153 154
             machine_id: machineID,
@@ -175,13 +176,13 @@ export default class NotificationsManager {
175 176
      * @param time
176 177
      */
177 178
     static setMachineReminderNotificationTime(time: number) {
178
-        console.log(time);
179 179
         let token = AsyncStorageManager.getInstance().preferences.expoToken.current;
180 180
         if (token === '') {
181 181
             throw Error('Expo token not available');
182 182
         }
183 183
         let data = {
184 184
             function: 'set_machine_reminder',
185
+            password: passwords.expoNotifications,
185 186
             token: token,
186 187
             time: time,
187 188
         };

Loading…
Cancel
Save