diff --git a/GMERemittance/Module/ForgotPassword/Application Logic/Interactor/ForgotPasswordInteractor.swift b/GMERemittance/Module/ForgotPassword/Application Logic/Interactor/ForgotPasswordInteractor.swift
index d43ce302..71dc1482 100644
--- a/GMERemittance/Module/ForgotPassword/Application Logic/Interactor/ForgotPasswordInteractor.swift
+++ b/GMERemittance/Module/ForgotPassword/Application Logic/Interactor/ForgotPasswordInteractor.swift
@@ -21,30 +21,6 @@ class ForgotPasswordInteractor {
self.service = service
}
-
- private func isValid(userName: String, dob: String) -> (isValid: Bool, error: Error){
- var error = ""
- var isValid = true
- if userName.contains("@") {
- if !Utility.isValidEmail(email: userName) {error = error + "email_valid_error".localized()
- isValid = false
- }
- }else {
- isValid = true
- if ( userName.rangeOfCharacter(from: NSCharacterSet.letters) != nil) {
- error = error + "email_valid_error".localized()
- isValid = false
- }
- }
-
-// if userName.isEmpty {
-// error = error + "email_valid_error".localized();
-// isValid = false
-// }
- let _error = NSError.init(domain: "ForgotPasswordInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : error])
- return (isValid, _error)
- }
-
// MARK: Converting entities
}
@@ -52,11 +28,6 @@ class ForgotPasswordInteractor {
extension ForgotPasswordInteractor: ForgotPasswordInteractorInput {
func reset(username: String, dob: String) {
- let result = self.isValid(userName: username, dob: dob)
- if !result.isValid {
- self.output?.show(error: result.error)
- return
- }
self.service.reset(username: username, dob: dob, success: { (message) in
self.output?.show(message: message)
KeyChain.shared.removeAll()
diff --git a/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift b/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
index d9fdeb58..07c80d5c 100644
--- a/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
+++ b/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
@@ -59,6 +59,8 @@ class ForgotPasswordViewController: UIViewController {
userNameTextField.statusImageView.isHidden = true
userNameTextField.validCondition = {
+ self.userNameTextField.filterForUserIDFormat()
+
if $0.count > 3 {
self.isValid = true
return self.isValid
@@ -75,6 +77,7 @@ class ForgotPasswordViewController: UIViewController {
userNameTextField.titleFont = font
userNameTextField.placeholder = StringConstants().userIdPlaceholder
userNameTextField.titleText = StringConstants().userIdTitleText
+ userNameTextField.errorMessage = "userid_error_text".localized()
resetButton.setTitle(StringConstants().resetText, for: UIControl.State.normal)
diff --git a/GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframe.swift b/GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframe.swift
index 679e7f64..37aef2fc 100644
--- a/GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframe.swift
+++ b/GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframe.swift
@@ -71,7 +71,10 @@ extension HomeWireframe: HomeWireframeInput {
}
func showPennyTestSubmit() {
- PennyTestSubmitWireframe().openMainView(source: view)
+ let vc = PennyTestSubmitWireframe().getMainView()
+ let navigationVC = UINavigationController(rootViewController: vc)
+ view.present(navigationVC, animated: true, completion: nil)
+
// self.pennyTestSubmitWireFrame.openPennyTestSubmit(with: view)
}
diff --git a/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractor.swift b/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractor.swift
index 76915456..8dcc5f93 100644
--- a/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractor.swift
+++ b/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractor.swift
@@ -9,82 +9,51 @@
import Foundation
class LoginInteractor {
-
- // MARK: Properties
-
- weak var output: LoginInteractorOutput?
- private let service: LoginServiceType
-
- // MARK: Initialization
-
- init(service: LoginServiceType) {
- self.service = service
- }
-
-
-
- func toBase64(text: String) -> String? {
- guard let data = text.data(using: String.Encoding.utf8) else {
- return nil
- }
-
- return data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0))
+
+ // MARK: Properties
+
+ weak var output: LoginInteractorOutput?
+ private let service: LoginServiceType
+
+ // MARK: Initialization
+
+ init(service: LoginServiceType) {
+ self.service = service
+ }
+
+ func toBase64(text: String) -> String? {
+ guard let data = text.data(using: String.Encoding.utf8) else {
+ return nil
}
- private func isValid(userName: String, password: String) -> (isValid: Bool, error: Error){
- var error = ""
- var isValid = true
- if userName.isEmpty {
- error = error + "\n" + "email_valid_error".localized();
- isValid = false
- }
-
- if password.isEmpty {error = error + "\n" + "password_empty_error".localized();
- isValid = false
- }
- let _error = NSError.init(domain: "LoginInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : error])
- return (isValid, _error)
- }
- // MARK: Converting entities
+ return data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0))
+ }
+
+ // MARK: Converting entities
}
// MARK: Login interactor input interface
extension LoginInteractor: LoginInteractorInput {
-
-
- func login(userName: String, password: String, encryptedPassword: String) {
- let username = userName
- let validationResult = self.isValid(userName: username, password: encryptedPassword)
- if !validationResult.isValid {
- self.output?.show(error: validationResult.error)
- return
- }
- guard let passwordBase64Data = self.toBase64(text: password) else {
- return
-
- }
- print("password converted is")
- print(passwordBase64Data)
-
- // send encrypted password to server for kftc
- self.service._login(userId: username, password: encryptedPassword, success: { (user) in
-
- let accessCode = user?.accessCode ?? ""
- let accessCodeBase64 = accessCode
- Utility.save(user: user, accessCodeBase64: accessCodeBase64, password: encryptedPassword, login: true)
-
- self.output?.loggedIn()
-
- }) { (error) in
- self.output?.show(error: error)
- guard
- let storedEmail = KeyChain.shared.get(key: .id),
- storedEmail == username else {
- return
- }
-
- KeyChain.shared.removeAll()
- }
+
+ func login(userName: String, encryptedPassword: String) {
+ // send encrypted password to server for kftc
+ self.service._login(userId: userName, password: encryptedPassword, success: { (user) in
+ let accessCode = user?.accessCode ?? ""
+ let accessCodeBase64 = accessCode
+ Utility.save(user: user, accessCodeBase64: accessCodeBase64, password: encryptedPassword, login: true)
+
+ self.output?.loggedIn()
+
+ }) { (error) in
+ self.output?.show(error: error)
+ guard
+ let storedEmail = KeyChain.shared.get(key: .id),
+ storedEmail == userName else {
+ return
+ }
+
+ KeyChain.shared.removeAll()
}
+ }
}
diff --git a/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractorIO.swift b/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractorIO.swift
index fba5ea96..91919ca5 100644
--- a/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractorIO.swift
+++ b/GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractorIO.swift
@@ -7,7 +7,7 @@
//
protocol LoginInteractorInput: class {
- func login(userName: String, password: String, encryptedPassword: String)
+ func login(userName: String, encryptedPassword: String)
}
protocol LoginInteractorOutput: class {
diff --git a/GMERemittance/Module/Login/Module Interface/LoginModuleInterface.swift b/GMERemittance/Module/Login/Module Interface/LoginModuleInterface.swift
index 5c3bb88d..d5fc3cc1 100644
--- a/GMERemittance/Module/Login/Module Interface/LoginModuleInterface.swift
+++ b/GMERemittance/Module/Login/Module Interface/LoginModuleInterface.swift
@@ -7,7 +7,7 @@
//
protocol LoginModuleInterface: class {
- func login(userName: String, password: String, encryptedPassword: String)
+ func login(userName: String, encryptedPassword: String)
func register()
func forgotPassword()
}
diff --git a/GMERemittance/Module/Login/User Interface/Presenter/LoginPresenter.swift b/GMERemittance/Module/Login/User Interface/Presenter/LoginPresenter.swift
index 7242aac0..639bca6b 100644
--- a/GMERemittance/Module/Login/User Interface/Presenter/LoginPresenter.swift
+++ b/GMERemittance/Module/Login/User Interface/Presenter/LoginPresenter.swift
@@ -22,9 +22,9 @@ class LoginPresenter {
// MARK: Login module interface
extension LoginPresenter: LoginModuleInterface {
- func login(userName: String, password: String, encryptedPassword: String) {
+ func login(userName: String, encryptedPassword: String) {
self.view?.showLoading()
- self.interactor?.login(userName: userName, password: password, encryptedPassword: encryptedPassword)
+ self.interactor?.login(userName: userName, encryptedPassword: encryptedPassword)
}
func register() {
diff --git a/GMERemittance/Module/Login/User Interface/View/Login.storyboard b/GMERemittance/Module/Login/User Interface/View/Login.storyboard
index 18116d96..b1d6a655 100644
--- a/GMERemittance/Module/Login/User Interface/View/Login.storyboard
+++ b/GMERemittance/Module/Login/User Interface/View/Login.storyboard
@@ -86,9 +86,9 @@
-