-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserController.java
More file actions
47 lines (41 loc) · 1.47 KB
/
UserController.java
File metadata and controls
47 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package User;
import java.util.ArrayList;
public class UserController extends PremiumUser {
public User signUp(String username, String pass, String email, String gender, String country, String birthDate) {
User u = new User();
if(username.isEmpty() && email.isEmpty() && pass.isEmpty() && gender.isEmpty()
&& country.isEmpty()&& birthDate.isEmpty()){
System.out.println("Please enter the missing information.");
}
for(int i = 0 ; i < u.users.size() ; i++){
if(email.equals(u.email));
System.out.println("This mail aleardy existing");
}
u.username = username;
u.email = email;
u.password = pass;
u.country = country;
u.birthDate = birthDate;
u.gender = gender;
return u;
}
public User login(String username, String password) {
User u = new User();
for(int i = 0 ; i < u.users.size() ; i++){
if (username.equals(u.username) && password.equals(u.password)) {
System.out.println("Welcome!" + u.username);
}
else if (username.equals(u.username)) {
System.out.println("Invalid Password!");
} else if (password.equals(u.password)) {
System.out.println("Invalid Username!");
} else {
System.out.println("Invalid Username & Password!");
}
}
return u;
}
public ArrayList<User> getAllUsers() {
return null;
}
}