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

Loading…
Cancel
Save