Skip to content

Commit aa560c5

Browse files
committed
Added comments to the code
1 parent 5b517bf commit aa560c5

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/main/java/screens/user_registration_screen/UserVerificationScreen.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
import javax.swing.*;
55
import java.awt.event.ActionEvent;
66
import java.awt.event.ActionListener;
7-
7+
/**
8+
* This is the class that is responsible for retrieving the verification code form the user, or presenting if
9+
* verification is not possible
10+
* */
811
public class UserVerificationScreen implements UserExistsOutputBoundary, ActionListener {
912
private final JTextField verText = new JTextField(20);
1013
private final UserVerificationInputBoundary verificationInputBoundary;
@@ -16,7 +19,9 @@ public class UserVerificationScreen implements UserExistsOutputBoundary, ActionL
1619
public UserVerificationScreen(UserVerificationInputBoundary verificationInputBoundary){
1720
this.verificationInputBoundary = verificationInputBoundary;
1821
}
19-
22+
/**
23+
* This method asks for the code from the user
24+
* */
2025
@Override
2126
public void getVerificationCredentials() {
2227
JFrame verificationFrame = new JFrame();
@@ -39,7 +44,9 @@ public void getVerificationCredentials() {
3944
verificationPanel.add(verifyButton);
4045
verificationFrame.setVisible(true);
4146
}
42-
47+
/**
48+
* This method presents that verification is not possible, because the user exists in the database
49+
* */
4350
@Override
4451
public void presentUserExistsMessage() {
4552
JFrame userExistsFrame = new JFrame();
@@ -54,12 +61,19 @@ public void presentUserExistsMessage() {
5461
userExistsPanel.add(accountExists);
5562
userExistsFrame.setVisible(true);
5663
}
57-
64+
/**
65+
* Retrieves code from the input boundary, to set the code onto the other input boundary in the constructor
66+
* @param code verification code
67+
* */
5868
@Override
5969
public void getCode(int code) {
6070
this.code = code;
6171
}
6272

73+
/**
74+
* Retrieves user credentials from the input boundary, in order to set the credentials onto the other input
75+
* boundary in the constructor
76+
* */
6377
@Override
6478
public void getUserCredentials(String username, String password, String email) {
6579
this.username = username;

src/main/java/use_cases/user_registration_use_cases/UserVerificationInteractor.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ public UserVerificationInteractor(Database database, UserVerificationOutputBound
1616
this.database = database;
1717
this.verificationOutputBoundary = verificationOutputBoundary;
1818
}
19-
19+
/**
20+
* Compares code with this.code, if they match, the program will proceed to ask for login credentials
21+
* Else, it will present a message that verification is not possible
22+
* @param code code inputted by the user
23+
* */
2024
@Override
2125
public void verify(int code) {
2226
System.out.println(this.code);
@@ -28,12 +32,16 @@ public void verify(int code) {
2832
}
2933

3034
}
31-
35+
/**
36+
* Sets the code to compare for verification
37+
* @param code verification code*/
3238
@Override
3339
public void setCode(int code) {
3440
this.code = code;
3541
}
36-
42+
/**
43+
* Sets the user credentials for this object
44+
* */
3745
public void setCredentials(String username, String password, String email){
3846
this.username = username;
3947
this.password = password;

0 commit comments

Comments
 (0)