sign_in_user method implemented
parent
359a88b773
commit
88493290fd
25
pom.xml
25
pom.xml
|
@ -28,6 +28,31 @@
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20210307</version>
|
<version>20210307</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.17.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>3.9</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>5.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>2.20.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -94,9 +94,19 @@ public class System {
|
||||||
return all_users;
|
return all_users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean sign_in_user(String username, String password){
|
public boolean sign_in_user(String username, String password) throws IOException {
|
||||||
|
ArrayList<User> mem = new ArrayList<>(get_all_user());
|
||||||
|
|
||||||
|
for(User user : mem){
|
||||||
|
if(user.getUsername().equals(username) && user.getPassword().equals(password)){
|
||||||
|
current_user = new User(user.getUsername(), user.getPassword(),
|
||||||
|
user.getHometown(), user.getZip(), user.getCar_name(),
|
||||||
|
user.getCar_l_100km(), user.getCar_avg_kmh(), user.getBike_avg_kmh());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean sign_up_user(String username, String password, String hometown, int zip,
|
public boolean sign_up_user(String username, String password, String hometown, int zip,
|
||||||
String car_name, double car_co2_km, double car_avg_kmh, double bike_avg_kmh){
|
String car_name, double car_co2_km, double car_avg_kmh, double bike_avg_kmh){
|
||||||
|
|
Loading…
Reference in New Issue