Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
Selim Eser | 11797b9b73 | |
Selim Eser | af6e9669b4 | |
David Groys | b92c488768 | |
Selim Eser | 7acdaf97a4 | |
Selim Eser | c6a209e27e | |
Selim Eser | 10fb4ac11c | |
Selim Eser | 5215d9b4f7 | |
Selim Eser | e0cd0c376f | |
Selim Eser | 0060368e0a | |
Selim Eser | 9dc98f62e7 | |
Selim Eser | 00a96494e6 | |
David Groys | f9fb48a3f4 |
|
@ -0,0 +1,3 @@
|
|||
Selim Eser 2211482: Selim Eser, Selim
|
||||
David Groys 3012642: David Groys
|
||||
Daniel Zdravkovic 3012893: Daniel Zdravkovic
|
|
@ -225,6 +225,9 @@ public class System {
|
|||
if (!new_password.equals(new_password_authentication))
|
||||
return false;
|
||||
|
||||
if(old_password.equals(new_password))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < this.all_user.size(); i++)
|
||||
if (this.all_user.get(i).getUsername().equals(current_user.getUsername()))
|
||||
this.all_user.remove(i);
|
||||
|
@ -276,7 +279,8 @@ public class System {
|
|||
String line;
|
||||
while ((line = reader.readLine()) != null && zip_set.size() < 200) {
|
||||
line = line.replace("\"", "");
|
||||
if (line.split(";")[0].contains(hometown_or_zip) || line.split(";")[1].contains(hometown_or_zip))
|
||||
if (line.split(";")[0].toUpperCase().startsWith(hometown_or_zip.toUpperCase())
|
||||
|| line.split(";")[1].toUpperCase().startsWith(hometown_or_zip.toUpperCase()))
|
||||
zip_set.add(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -343,13 +347,24 @@ public class System {
|
|||
|
||||
try {
|
||||
HttpClient http_client = HttpClient.newHttpClient();
|
||||
|
||||
HttpRequest get_request = HttpRequest.newBuilder()
|
||||
HttpRequest get_request;
|
||||
|
||||
if(current_user.getZip().length()<5){
|
||||
get_request = HttpRequest.newBuilder()
|
||||
.uri(new URI("https://api.openweathermap.org/data/2.5/weather?q=" + current_user.getHometown()
|
||||
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
|
||||
.GET()
|
||||
.build();
|
||||
}
|
||||
|
||||
else{
|
||||
get_request = HttpRequest.newBuilder()
|
||||
.uri(new URI("https://api.openweathermap.org/data/2.5/weather?zip=" + current_user.getZip()
|
||||
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString());
|
||||
|
||||
JSONObject json = new JSONObject(get_response.body());
|
||||
|
@ -409,13 +424,23 @@ public class System {
|
|||
|
||||
try {
|
||||
HttpClient http_client = HttpClient.newHttpClient();
|
||||
|
||||
HttpRequest get_request = HttpRequest.newBuilder()
|
||||
HttpRequest get_request;
|
||||
|
||||
if(destination_zip.length()<5){
|
||||
get_request = HttpRequest.newBuilder()
|
||||
.uri(new URI("https://api.openweathermap.org/data/2.5/forecast?q=" + search(destination_zip).get(0).split(";")[1]
|
||||
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
|
||||
.GET()
|
||||
.build();
|
||||
}
|
||||
else{
|
||||
get_request = HttpRequest.newBuilder()
|
||||
.uri(new URI("https://api.openweathermap.org/data/2.5/forecast?zip=" + destination_zip
|
||||
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString());
|
||||
|
||||
JSONObject json = new JSONObject(get_response.body());
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue