Forbids multi device authentication

club_update
Laurent 1 year ago
parent b72ce42d95
commit 38bbbb3246
  1. 8
      PadelClub/Data/DataStore.swift
  2. 1
      PadelClub/Data/README.md
  3. 11
      PadelClub/Data/User.swift

@ -163,8 +163,16 @@ class DataStore: ObservableObject {
if await StoreCenter.main.hasPendingAPICalls() {
// todo qu'est ce qu'on fait des API Call ?
}
do {
let services = try StoreCenter.main.service()
try await services.logout()
} catch {
Logger.error(error)
}
}
StoreCenter.main.disconnect()
StoreCenter.main.collectionsCanSynchronize = false

@ -13,6 +13,7 @@ Dans Django:
- S'il c'est un champ dans **CustomUser**:
- Ajouter le champ à la méthode fields_for_update
- Ajouter le champ dans UserSerializer > create > create_user dans serializers.py
- L'ajouter aussi dans admin.py si nécéssaire
- Faire le *makemigrations* + *migrate*

@ -44,6 +44,8 @@ class User: ModelObject, UserBase, Storable {
var groupStageMatchFormatPreference: MatchFormat?
var loserBracketMatchFormatPreference: MatchFormat?
var deviceId: String?
init(username: String, email: String, firstName: String, lastName: String, phone: String?, country: String?) {
self.username = username
self.firstName = firstName
@ -129,7 +131,7 @@ class User: ModelObject, UserBase, Storable {
case _bracketMatchFormatPreference = "bracketMatchFormatPreference"
case _groupStageMatchFormatPreference = "groupStageMatchFormatPreference"
case _loserBracketMatchFormatPreference = "loserBracketMatchFormatPreference"
case _deviceId = "deviceId"
}
func encode(to encoder: Encoder) throws {
@ -212,6 +214,13 @@ class User: ModelObject, UserBase, Storable {
} else {
try container.encodeNil(forKey: ._loserBracketMatchFormatPreference)
}
if let deviceId {
try container.encode(deviceId, forKey: ._deviceId)
} else {
try container.encodeNil(forKey: ._deviceId)
}
}
static func placeHolder() -> User {

Loading…
Cancel
Save