In register Im verifiying email and going to my account. When i log in with same email that is verified, it will say Invalid Credentials
In register Im verifiying email and going to my account. When i log in with same email that is verified, it will say Invalid Credentials, this is the method
func userLoginApiHit(){
DispatchQueue.main.async {
CommonFunctions.startProgressView(view: self.view)
}
let parameters = "{\n \"email\": \"\(emailTxtffld.text!)\",\n \"password\":\"\(passwrdTxtfld.text!)\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "API")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
DispatchQueue.main.async {
CommonFunctions.dismissProgressView(view: self.view)
}
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
let json = JSON(data: data)
print("json response \(json)")
if json == "Invalid Credentials" {
DispatchQueue.main.async {
CommonFunctions.showAlert(self, message: "Invalid Credentials", title: appName)
}
}
else {
DataManager.CurrentUserID = String(json["id"].intValue)
objUser.parseUserData(responseDict: json)
DispatchQueue.main.async {
let vc = Storyboard.instantiateViewController(withIdentifier: "TabBarViewController") as! TabBarViewController
self.navigationController?.pushViewController(vc,animated: true)
}
}
}
task.resume()
}