Browse Source

Use generic password instead of internet credentials

Arnaud Vergnet 3 years ago
parent
commit
00ed963503
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      src/managers/ConnectionManager.ts

+ 3
- 4
src/managers/ConnectionManager.ts View File

@@ -34,7 +34,6 @@ import {apiRequest, ERROR_TYPE} from '../utils/WebData';
34 34
  * 500 : SERVER_ERROR -> pb coté serveur
35 35
  */
36 36
 
37
-const SERVER_NAME = 'amicale-insat.fr';
38 37
 const AUTH_PATH = 'password';
39 38
 
40 39
 export default class ConnectionManager {
@@ -78,7 +77,7 @@ export default class ConnectionManager {
78 77
       if (token != null) {
79 78
         resolve();
80 79
       } else {
81
-        Keychain.getInternetCredentials(SERVER_NAME)
80
+        Keychain.getGenericPassword()
82 81
           .then((data: Keychain.UserCredentials | false) => {
83 82
             if (data && data.password != null) {
84 83
               this.token = data.password;
@@ -108,7 +107,7 @@ export default class ConnectionManager {
108 107
    */
109 108
   async saveLogin(email: string, token: string): Promise<void> {
110 109
     return new Promise((resolve: () => void, reject: () => void) => {
111
-      Keychain.setInternetCredentials(SERVER_NAME, 'token', token)
110
+      Keychain.setGenericPassword('token', token)
112 111
         .then(() => {
113 112
           this.token = token;
114 113
           resolve();
@@ -124,7 +123,7 @@ export default class ConnectionManager {
124 123
    */
125 124
   async disconnect(): Promise<void> {
126 125
     return new Promise((resolve: () => void, reject: () => void) => {
127
-      Keychain.resetInternetCredentials(SERVER_NAME)
126
+      Keychain.resetGenericPassword()
128 127
         .then(() => {
129 128
           this.token = null;
130 129
           resolve();

Loading…
Cancel
Save