pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift
branchIOS-1542
changeset 8376 f517a983ae7c
parent 8375 81ef9257d9b5
child 8381 907e287ead66
equal deleted inserted replaced
8375:81ef9257d9b5 8376:f517a983ae7c
   107         verifiableAccount = theVerifier
   107         verifiableAccount = theVerifier
   108 
   108 
   109         theVerifier.address = email
   109         theVerifier.address = email
   110         theVerifier.userName = name
   110         theVerifier.userName = name
   111 
   111 
   112         theVerifier.password = originalPassword
       
   113         if password != nil {
       
   114             theVerifier.password = password
       
   115         }
       
   116 
       
   117         if loginName != email {
   112         if loginName != email {
   118             theVerifier.loginName = loginName
   113             theVerifier.loginName = loginName
   119         }
   114         }
   120 
   115 
   121         if isOAuth2 {
   116         if isOAuth2 {
   122             // TODO: Set correct auth method, etc.
   117             if self.accessToken == nil {
       
   118                 Logger.frontendLogger.errorAndCrash("Have to do OAUTH2, but lacking current token")
       
   119             }
       
   120             theVerifier.authMethod = .saslXoauth2
       
   121             theVerifier.accessToken = accessToken
       
   122             // OAUTH2 trumps any password
       
   123             theVerifier.password = nil
       
   124         } else {
       
   125             theVerifier.password = originalPassword
       
   126             if password != nil {
       
   127                 theVerifier.password = password
       
   128             }
   123         }
   129         }
   124 
   130 
   125         // IMAP
   131         // IMAP
   126         theVerifier.serverIMAP = imap.address
   132         theVerifier.serverIMAP = imap.address
   127         if let portString = imap.port, let port = UInt16(portString) {
   133         if let portString = imap.port, let port = UInt16(portString) {