Commit 6643b3a2 authored by Jose Blaya's avatar Jose Blaya
Browse files

Save temp account password in memory after changing the email

Refactor
parent 6c600b69
......@@ -26,8 +26,8 @@
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" translatesAutoresizingMaskIntoConstraints="NO" id="B1H-gR-q8M">
<rect key="frame" x="8" y="8" width="359" height="674"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="V0h-yl-QM9">
<rect key="frame" x="0.0" y="0.0" width="359" height="674"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="V0h-yl-QM9">
<rect key="frame" x="1" y="1" width="359" height="674"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YGH-7v-4mS">
<rect key="frame" x="0.0" y="100" width="359" height="474"/>
......
......@@ -151,7 +151,10 @@ extension Client {
// MARK: Access to Data PublicKey
private let accessQueue = DispatchQueue(label: "SynchronizedDataAccess",
attributes: .concurrent)
/// Store the account password in memory when the email is set and the user is LoggedIn.
public var tempAccountPassword: String
// MARK: Initialization
init() {
......@@ -217,6 +220,7 @@ extension Client {
#endif
maxQuickConnectServers = 6
tempAccountPassword = ""
if let publicKey = database.secure.publicKeyEntry() {
self.publicKey = publicKey
......
......@@ -120,11 +120,16 @@ class PIAWebServices: WebServices, ConfigurationAccess {
let parameters = ["email": email, "reset_password": reset] as [String : Any]
let status = [200]
req(credentials, .post, endpoint, useAuthToken: false, parameters, status, JSONRequestExecutor() { (json, status, error) in
req(reset ? nil : credentials, .post, endpoint, useAuthToken: reset, parameters, status, JSONRequestExecutor() { (json, status, error) in
if let error = error {
callback?(error)
return
}
if let newPassword = json?["password"] as? String {
Client.configuration.tempAccountPassword = newPassword
}
callback?(nil)
})
}
......
......@@ -432,7 +432,7 @@ public extension UIAlertController {
}
}
extension String {
public extension String {
func trimmed() -> String {
return trimmingCharacters(in: .whitespacesAndNewlines)
}
......
......@@ -68,9 +68,7 @@ public class SignupSuccessViewController: AutolayoutViewController, BrandableNav
self.styleSubmitButton()
self.styleContainers()
buttonSubmit.isUserInteractionEnabled = true
}
@IBAction private func submit() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment