From 1fbed97fb2a5f6b5ebe82edeced68405c3b1d4be Mon Sep 17 00:00:00 2001 From: wiecktobi Date: Wed, 27 May 2020 22:55:21 +0200 Subject: [PATCH] Update input fields and buttons plus fix security gap at logout --- android/.idea/misc.xml | 2 +- android/app/build.gradle | 2 +- .../de/hft/geotracker/activities/Login.kt | 5 +- .../hft/geotracker/activities/MainActivity.kt | 8 +-- .../app/src/main/res/layout/activity_home.xml | 3 +- .../src/main/res/layout/activity_login.xml | 68 ++++++++++++------- .../src/main/res/layout/activity_register.xml | 12 ++-- .../src/main/res/layout/settings_activity.xml | 2 +- android/app/src/main/res/values/colors.xml | 4 +- android/app/src/main/res/values/strings.xml | 3 +- android/app/src/main/res/values/styles.xml | 5 ++ 11 files changed, 69 insertions(+), 45 deletions(-) diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml index 7bfef59..b6ea2b1 100644 --- a/android/.idea/misc.xml +++ b/android/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/android/app/build.gradle b/android/app/build.gradle index cb3d488..6dbdb6b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -40,7 +40,7 @@ dependencies { implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.material:material:1.2.0-alpha06' + implementation 'com.google.android.material:material:1.1.0' implementation "com.google.android.gms:play-services-location:17.0.0" implementation 'androidx.preference:preference:1.1.1' testImplementation 'junit:junit:4.13' diff --git a/android/app/src/main/java/de/hft/geotracker/activities/Login.kt b/android/app/src/main/java/de/hft/geotracker/activities/Login.kt index 005cd3e..e1e02a0 100644 --- a/android/app/src/main/java/de/hft/geotracker/activities/Login.kt +++ b/android/app/src/main/java/de/hft/geotracker/activities/Login.kt @@ -19,6 +19,7 @@ import retrofit2.Callback import retrofit2.Response import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory +import kotlinx.android.synthetic.main.activity_login.* /** * A simple [Fragment] subclass. @@ -70,8 +71,8 @@ class Login : AppCompatActivity() { } private fun login() { - val name = findViewById(R.id.setting_input_username).text.toString() - val pswd = findViewById(R.id.input_password).text.toString() + val name = input_username.text.toString() + val pswd = input_password.text.toString() val call = service.login(ValuesUserLogin(name, pswd)) call.enqueue(object : Callback { diff --git a/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt b/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt index bfdeea4..836d029 100644 --- a/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt +++ b/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt @@ -5,7 +5,6 @@ import android.app.PendingIntent import android.content.Context import android.content.Intent import android.content.pm.PackageManager -import android.location.Location import android.os.Bundle import android.os.Looper import android.widget.ArrayAdapter @@ -15,10 +14,6 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat.requestPermissions import com.google.android.gms.location.* -import com.google.android.gms.location.Geofence -import com.google.android.gms.location.GeofencingClient -import com.google.android.gms.location.GeofencingRequest -import com.google.android.gms.location.LocationServices import de.hft.geotracker.GeofenceBroadcastReceiver import de.hft.geotracker.R import de.hft.geotracker.retrofit.AuthenticationInterceptor @@ -33,8 +28,6 @@ import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import java.io.BufferedReader import java.io.InputStreamReader -import java.lang.StringBuilder -import kotlin.properties.Delegates class MainActivity : AppCompatActivity() { @@ -150,6 +143,7 @@ class MainActivity : AppCompatActivity() { true } R.id.logout -> { + deleteFile("JWToken") startActivity(Intent(this, Login::class.java)) println("Logout pressed") true diff --git a/android/app/src/main/res/layout/activity_home.xml b/android/app/src/main/res/layout/activity_home.xml index c9bb8af..61a59bd 100644 --- a/android/app/src/main/res/layout/activity_home.xml +++ b/android/app/src/main/res/layout/activity_home.xml @@ -8,8 +8,6 @@ android:background="@color/background_grey" tools:context=".activities.MainActivity"> - - diff --git a/android/app/src/main/res/layout/activity_login.xml b/android/app/src/main/res/layout/activity_login.xml index 52cfba4..d496f1a 100644 --- a/android/app/src/main/res/layout/activity_login.xml +++ b/android/app/src/main/res/layout/activity_login.xml @@ -22,70 +22,92 @@ app:title="@string/app_name" /> - + app:layout_constraintVertical_chainStyle="packed"> - + + + + app:layout_constraintTop_toBottomOf="@+id/input_username_layout" + app:layout_constraintVertical_bias="0.13"> + + +