Skip to content

Commit 8e7ad35

Browse files
committed
Some error handling for empty text fields
1 parent e627dac commit 8e7ad35

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed
Binary file not shown.

DVIA-v2/DVIA-v2/Vulnerabilities/Runtime Manipulation/Controller/RuntimeManipulationDetailsViewController.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class RuntimeManipulationDetailsViewController: UIViewController, UITextFieldDel
4848
}
4949

5050
@IBAction func loginMethod1Tapped(_ sender: Any) {
51+
if usernameTextField.text?.isEmpty ?? true || passwordTextField.text?.isEmpty ?? true {
52+
DVIAUtilities.showAlert(title: "Error", message: "One or more input fields is empty.", viewController: self)
53+
return
54+
}
5155
if LoginValidate.isLoginValidated() {
5256
DVIAUtilities.showAlert(title: "Congratulations", message: "You have successfully bypassed the authentication check.", viewController: self)
5357
} else {
@@ -56,8 +60,12 @@ class RuntimeManipulationDetailsViewController: UIViewController, UITextFieldDel
5660
}
5761

5862
@IBAction func loginMethod2Tapped(_ sender: Any) {
63+
if usernameTextField.text?.isEmpty ?? true || passwordTextField.text?.isEmpty ?? true {
64+
DVIAUtilities.showAlert(title: "Error", message: "One or more input fields is empty.", viewController: self)
65+
return
66+
}
5967
// TODO: change username and password text in this code.
60-
if usernameTextField.text == "" && passwordTextField.text == "" {
68+
if usernameTextField.text == "admin13412" && passwordTextField.text == "S@g@rm@7h@8848" {
6169
DVIAUtilities.showAlert(title: "Congratulations", message: "You have successfully bypassed the authentication check.", viewController: self)
6270
} else {
6371
DVIAUtilities.showAlert(title: "Oops", message: "Incorrect Username or Password", viewController: self)

DVIA-v2/DVIA-v2/Vulnerabilities/Transport Layer Protection/Controller/TransportLayerProtectionViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ class TransportLayerProtectionViewController: UIViewController {
8888
}
8989

9090
func sendRequestOverUrl(_ url: URL) {
91+
if cardNumberTextField.text?.isEmpty ?? true || nameOnCardTextField.text?.isEmpty ?? true || CVVTextField.text?.isEmpty ?? true {
92+
DVIAUtilities.showAlert(title: "Error", message: "One or more input fields is empty.", viewController: self)
93+
return
94+
}
9195
if(!Reachability.isConnectedToNetwork()){
9296
DVIAUtilities.showAlert(title: "Error", message: "Make sure you are connected to the internet.", viewController: self)
9397
return

0 commit comments

Comments
 (0)