mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
App directs user to Login page if not logged in
This commit is contained in:
parent
ff14f59ddd
commit
8dd2f33b42
@ -60,6 +60,10 @@ public class AuthManager {
|
||||
return authSession.getUserPoolTokens().getValue().getIdToken();
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import com.example.listify.data.Item;
|
||||
import com.example.listify.data.ItemSearch;
|
||||
import com.example.listify.data.List;
|
||||
import com.example.listify.data.ListEntry;
|
||||
import com.example.listify.ui.LoginPage;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import static com.example.listify.SplashActivity.showSplash;
|
||||
|
||||
@ -52,6 +53,11 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
||||
}, 1);
|
||||
}
|
||||
|
||||
if(am.getEmail() == null) {
|
||||
Intent intent = new Intent(MainActivity.this, LoginPage.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------Auth Testing---------------------------------------------//
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
||||
if(!cancel) {
|
||||
try {
|
||||
am.confirmSignUp(code);
|
||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||
Intent intent = new Intent(SignupPage.this, LoginPage.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@ -68,6 +68,9 @@ public class HomeFragment extends Fragment {
|
||||
}
|
||||
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||
am.deleteUser(requestor);
|
||||
|
||||
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:ems="10"
|
||||
android:hint="Code"
|
||||
android:inputType="textPersonName"
|
||||
android:hint=""
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
android:layout_marginTop="23dp"
|
||||
android:ems="10"
|
||||
android:hint="Password"
|
||||
android:inputType="textPersonName"
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintStart_toStartOf="@+id/editTextTextEmailAddress"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextTextEmailAddress" />
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user