mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-05-03 20:05:17 +00:00
COVIDSafe code from version 2.4
This commit is contained in:
parent
377bc0009b
commit
86a09a138c
40 changed files with 1125 additions and 657 deletions
|
@ -228,19 +228,21 @@ class OTPViewController: UIViewController, RegistrationHandler {
|
|||
let session = UserDefaults.standard.string(forKey: "session") ?? ""
|
||||
RespondToAuthChallengeAPI.respondToAuthChallenge(session: session,
|
||||
code: OTP)
|
||||
{ (token: String?, error: Error?) in
|
||||
{ (response: ChallengeResponse?, error: Error?) in
|
||||
if let error = error {
|
||||
// User was not signed in. Display error.
|
||||
DLog(error.localizedDescription)
|
||||
result(.WrongOTP)
|
||||
return
|
||||
}
|
||||
guard let tokenToStore = token else {
|
||||
guard let tokenToStore = response?.token,
|
||||
let refreshToken = response?.refreshToken else {
|
||||
result(.WrongOTP)
|
||||
return
|
||||
}
|
||||
let keychain = KeychainSwift()
|
||||
keychain.set(tokenToStore, forKey: "JWT_TOKEN", withAccess: .accessibleAfterFirstUnlock)
|
||||
keychain.set(refreshToken, forKey: "REFRESH_TOKEN", withAccess: .accessibleAfterFirstUnlock)
|
||||
UserDefaults.standard.set(true, forKey: "HasUpdatedKeychainAccess")
|
||||
UserDefaults.standard.set(false, forKey: "ReauthenticationNeededKey")
|
||||
result(.Success)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue