mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
commit
2028e5c628
@ -39,7 +39,6 @@
|
|||||||
<activity android:name="com.example.listify.ui.SignupPage" />
|
<activity android:name="com.example.listify.ui.SignupPage" />
|
||||||
<activity android:name="com.example.listify.ui.LoginPage" />
|
<activity android:name="com.example.listify.ui.LoginPage" />
|
||||||
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
||||||
<activity android:name="com.example.listify.ui.ResetPasswordPage" />
|
|
||||||
<activity android:name="com.example.listify.ListPage" />
|
<activity android:name="com.example.listify.ListPage" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
@ -158,13 +158,13 @@ public class AuthManager {
|
|||||||
|
|
||||||
public void changePassword(String email) throws AuthException {
|
public void changePassword(String email) throws AuthException {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
waiting = true;
|
//waiting = true;
|
||||||
Amplify.Auth.resetPassword(email, result -> setAuthResetPasswordResult(result), error -> setAuthError(error));
|
Amplify.Auth.resetPassword(email, result -> setAuthResetPasswordResult(result), error -> setAuthError(error));
|
||||||
throwIfAuthError();
|
throwIfAuthError();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void confirmPasswordReset(String newPassword, String confirmationCode) throws AuthException {
|
public void confirmPasswordReset(String newPassword, String confirmationCode) throws AuthException {
|
||||||
waiting = true;
|
//waiting = true;
|
||||||
Amplify.Auth.confirmResetPassword(newPassword, confirmationCode, this::passwordResetSuccess, this::setAuthError);
|
Amplify.Auth.confirmResetPassword(newPassword, confirmationCode, this::passwordResetSuccess, this::setAuthError);
|
||||||
throwIfAuthError();
|
throwIfAuthError();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ public class ListPage extends AppCompatActivity {
|
|||||||
try {
|
try {
|
||||||
list = lr.await();
|
list = lr.await();
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch (Exception e) {
|
||||||
list = null;
|
list = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,8 @@ public class ListPage extends AppCompatActivity {
|
|||||||
Item item;
|
Item item;
|
||||||
try {
|
try {
|
||||||
item = pr.await();
|
item = pr.await();
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
if(item != null) {
|
if(item != null) {
|
||||||
|
|||||||
@ -94,7 +94,9 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
requestor.postObject(testList, idReceiver, idReceiver);
|
requestor.postObject(testList, idReceiver, idReceiver);
|
||||||
System.out.println(idReceiver.await());
|
System.out.println(idReceiver.await());
|
||||||
requestor.postObject(entry);
|
requestor.postObject(entry);
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Log.i("Authentication", e.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,10 @@ import android.os.Bundle;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
import com.example.listify.R;
|
import com.example.listify.R;
|
||||||
|
import static com.example.listify.MainActivity.am;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
@ -22,6 +24,14 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
|||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
EditText emailText = (EditText) findViewById(R.id.editTextTextEmailAddress2);
|
||||||
|
String email = emailText.getText().toString();
|
||||||
|
try {
|
||||||
|
am.changePassword(email);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Log.i("Authentication", e.toString());
|
||||||
|
}
|
||||||
openDialog();
|
openDialog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -34,15 +44,16 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendCode(String code, boolean cancel) {
|
public void sendCode(String code, boolean cancel) {
|
||||||
Intent intent;
|
if(!cancel) {
|
||||||
|
try {
|
||||||
if(cancel) {
|
am.confirmPasswordReset("qwertyuiop", code);
|
||||||
intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Log.i("Authentication", e.toString());
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
intent = new Intent(ForgotPasswordPage.this, ResetPasswordPage.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Intent intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package com.example.listify.ui;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
import com.example.listify.R;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
public class ResetPasswordPage extends AppCompatActivity {
|
|
||||||
private Button button1; //Log in page button
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_resetpswd);
|
|
||||||
|
|
||||||
button1 = (Button) findViewById(R.id.button1);
|
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent intent = new Intent(ResetPasswordPage.this, LoginPage.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -45,7 +45,8 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
|||||||
try {
|
try {
|
||||||
am.startSignUp(email, password);
|
am.startSignUp(email, password);
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch (Exception e) {
|
||||||
|
Log.i("Authentication", e.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,17 +62,14 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendCode(String code, boolean cancel) {
|
public void sendCode(String code, boolean cancel) {
|
||||||
if(cancel) {
|
if(!cancel) {
|
||||||
//Remove user from database
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
am.confirmSignUp(code);
|
am.confirmSignUp(code);
|
||||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
//Remove user from database
|
Log.i("Authentication", e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:text="Button"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/editTextTextPassword2"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/editTextTextPassword2"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/editTextTextPassword2" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/editTextTextPassword3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="272dp"
|
|
||||||
android:ems="10"
|
|
||||||
android:hint="New password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/editTextTextPassword2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="26dp"
|
|
||||||
android:ems="10"
|
|
||||||
android:hint="Confirm new password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/editTextTextPassword3"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/editTextTextPassword3" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView5"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="28dp"
|
|
||||||
android:layout_marginEnd="31dp"
|
|
||||||
android:text="Create a new password"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/editTextTextPassword3"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/editTextTextPassword3" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
Loading…
Reference in New Issue
Block a user