sign_up_user method now requires password authentication
parent
a2e432119e
commit
b66b2314d8
|
@ -111,7 +111,7 @@ public class System {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean sign_up_user(String username, String password, String hometown, String zip,
|
||||
public boolean sign_up_user(String username, String password, String password_authentication, String hometown, String zip,
|
||||
String car_name, String car_l_100kmS, String car_avg_kmhS, String bike_avg_kmhS){
|
||||
|
||||
double car_l_100km;
|
||||
|
@ -129,6 +129,9 @@ public class System {
|
|||
if(username.equals("")||password.equals("")||hometown.equals("")||zip.equals(""))
|
||||
return false;
|
||||
|
||||
if(!password.equals(password_authentication))
|
||||
return false;
|
||||
|
||||
for(User user: this.all_user)
|
||||
if(user.getUsername().equals(username))
|
||||
return false;
|
||||
|
|
|
@ -16,9 +16,9 @@ public class Application {
|
|||
return running_system.sign_in_user(username, password);
|
||||
}
|
||||
|
||||
public boolean sign_up_user(String username, String password, String hometown, String zip,
|
||||
public boolean sign_up_user(String username, String password, String password_authentication, String hometown, String zip,
|
||||
String car_name, String car_co2_km, String car_avg_kmh, String bike_avg_kmh){
|
||||
return running_system.sign_up_user(username, password, hometown, zip, car_name, car_co2_km, car_avg_kmh, bike_avg_kmh);
|
||||
return running_system.sign_up_user(username, password, password_authentication, hometown, zip, car_name, car_co2_km, car_avg_kmh, bike_avg_kmh);
|
||||
}
|
||||
|
||||
public void sign_out_user(){
|
||||
|
|
|
@ -123,11 +123,11 @@ public class SystemTest {
|
|||
@Test
|
||||
public void sign_up_user(){
|
||||
// Username darf nicht doppelt vorkommen!
|
||||
assertEquals(false, current_system.sign_up_user("David","123Esel","Mannheim","68161","AMG","10","300","20"));
|
||||
assertEquals(true, current_system.sign_up_user("Selim","Penis69","Mannheim","68161","AMG","10","300","20"));
|
||||
assertEquals(false, current_system.sign_up_user("David","123Esel","123Esel","Mannheim","68161","AMG","10","300","20"));
|
||||
assertEquals(true, current_system.sign_up_user("Selim","Penis69","Penis69","Mannheim","68161","AMG","10","300","20"));
|
||||
// PLZ muss mit Stadt übereinstimmen
|
||||
assertEquals(false, current_system.sign_up_user("Lukas","123Esel","Mannheim","11105","AMG","10","300","20"));
|
||||
assertEquals(true, current_system.sign_up_user("Lukas","123Esel","Mannheim","68305","AMG","10","300","20"));
|
||||
assertEquals(false, current_system.sign_up_user("Lukas","123Esel","123Esel","Mannheim","11105","AMG","10","300","20"));
|
||||
assertEquals(true, current_system.sign_up_user("Lukas","123Esel","123Esel","Mannheim","68305","AMG","10","300","20"));
|
||||
|
||||
assertEquals("Lukas",current_system.getDetails()[0]);
|
||||
current_system.sign_out_user();
|
||||
|
|
Loading…
Reference in New Issue