Password Change now implemented and change reflected and persistent through auto log in

This commit is contained in:
Okechi Onyeje 2016-08-29 20:21:38 -04:00
parent 33f5b51974
commit 48f7c10de8
3 changed files with 43 additions and 9 deletions

View File

@ -230,7 +230,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.775639" timestampString = "494209191.241024"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "460" startingLineNumber = "460"
@ -245,7 +245,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.776282" timestampString = "494209191.241192"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "460" startingLineNumber = "460"
@ -278,7 +278,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.778069" timestampString = "494209191.241994"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "479" startingLineNumber = "479"
@ -293,7 +293,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.778442" timestampString = "494209191.242121"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "481" startingLineNumber = "481"
@ -342,7 +342,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.780562" timestampString = "494209191.243433"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "498" startingLineNumber = "498"
@ -357,7 +357,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.780713" timestampString = "494209191.243578"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "498" startingLineNumber = "498"
@ -372,7 +372,7 @@
moduleName = "Vendoo" moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift" urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/ListingPreviewViewController.swift"
timestampString = "494088391.780851" timestampString = "494209191.24367"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "500" startingLineNumber = "500"
@ -678,5 +678,21 @@
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/SignInViewController.swift"
timestampString = "494208703.800413"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "65"
endingLineNumber = "65"
landmarkName = "signInUser(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>

View File

@ -8,6 +8,7 @@
import UIKit import UIKit
import Locksmith import Locksmith
import FirebaseAuth
class SettingsViewController: UIViewController { class SettingsViewController: UIViewController {
@ -106,7 +107,7 @@ extension SettingsViewController: UITableViewDelegate {
//put in password changing code later //put in password changing code later
print("password accepted please enter new password") print("password accepted please enter new password")
let alert2 = UIAlertController(title: "Change Password", message: "WARNING! You are about to change your vendoo account password. Please enter your current password to continue.", preferredStyle: .Alert) let alert2 = UIAlertController(title: "Change Password", message: "WARNING! You are about to change your vendoo account password. Please enter your new password to continue.", preferredStyle: .Alert)
alert2.addTextFieldWithConfigurationHandler({ (textField : UITextField!) -> Void in alert2.addTextFieldWithConfigurationHandler({ (textField : UITextField!) -> Void in
@ -116,8 +117,25 @@ extension SettingsViewController: UITableViewDelegate {
alert2.addAction(UIAlertAction(title: "Change Password", style: .Default, handler:{(action: UIAlertAction!) in alert2.addAction(UIAlertAction(title: "Change Password", style: .Default, handler:{(action: UIAlertAction!) in
let textField2 = alert2.textFields![0] as UITextField let textField2 = alert2.textFields![0] as UITextField
FIRAuth.auth()?.currentUser?.updatePassword(textField2.text!, completion: {
(error) -> Void in
print("your new password is \(textField2.text!). This will be take out once password change logic is implemented.") if (error != nil) {
print(error)
}else {
print("Current user's new password is now \(textField2.text!).")
do{
try Locksmith.updateData(["pass": textField2.text!], forUserAccount: (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!, inService: "vendoo")
print("account credentials saved")
}
catch{
//could not save data to keychain
print("account credentials could not be saved")
}
}
})
})) }))
alert.dismissViewControllerAnimated(false, completion: {}) alert.dismissViewControllerAnimated(false, completion: {})