mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 18:48:48 +00:00
Added Confirm Password to Forgot Password
This commit is contained in:
parent
8acf630382
commit
6337422f52
@ -18,6 +18,7 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
|||||||
|
|
||||||
String email;
|
String email;
|
||||||
String newPassword;
|
String newPassword;
|
||||||
|
String confirmNewPassword;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -28,19 +29,25 @@ 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);
|
EditText emailText = (EditText) findViewById(R.id.editTextTextEmailAddress);
|
||||||
EditText newPasswordText = (EditText) findViewById(R.id.editTextTextPassword2);
|
EditText newPasswordText = (EditText) findViewById(R.id.editTextTextPassword);
|
||||||
|
EditText confirmNewPasswordText = (EditText) findViewById(R.id.editTextTextPassword2);
|
||||||
|
|
||||||
email = emailText.getText().toString();
|
email = emailText.getText().toString();
|
||||||
newPassword = newPasswordText.getText().toString();
|
newPassword = newPasswordText.getText().toString();
|
||||||
|
confirmNewPassword = confirmNewPasswordText.getText().toString();
|
||||||
|
|
||||||
|
if(!newPassword.equals(confirmNewPassword)) {
|
||||||
|
TextView invalidCred = findViewById(R.id.textView6);
|
||||||
|
invalidCred.setText("\"Confirm New Password\" does not match \"New Password\".");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
am.changePassword(email);
|
am.changePassword(email);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
TextView invalidCred = findViewById(R.id.textView6);
|
|
||||||
invalidCred.setText("Password criteria not met. Please try again.");
|
|
||||||
}
|
}
|
||||||
openDialog();
|
openDialog();
|
||||||
}
|
}
|
||||||
@ -60,6 +67,8 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
|||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
TextView invalidCred = findViewById(R.id.textView6);
|
||||||
|
invalidCred.setText("Password criteria not met. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,51 +9,64 @@
|
|||||||
android:id="@+id/button1"
|
android:id="@+id/button1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="52dp"
|
android:layout_marginTop="51dp"
|
||||||
android:text="Submit"
|
android:text="Submit"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textView6"
|
app:layout_constraintEnd_toStartOf="@+id/textView6"
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView6"
|
app:layout_constraintStart_toStartOf="@+id/textView6"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/editTextTextPassword2" />
|
app:layout_constraintTop_toBottomOf="@+id/editTextTextPassword2" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextTextEmailAddress2"
|
android:id="@+id/editTextTextEmailAddress"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="295dp"
|
android:layout_marginTop="263dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Email"
|
android:hint="Email"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
app:layout_constraintStart_toStartOf="@+id/editTextTextPassword2"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/editTextTextPassword"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="35dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="New Password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/editTextTextEmailAddress"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/editTextTextEmailAddress" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editTextTextPassword2"
|
android:id="@+id/editTextTextPassword2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="31dp"
|
android:layout_marginTop="35dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="New Password"
|
android:hint="Confirm New Password"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textView6"
|
app:layout_constraintEnd_toStartOf="@+id/textView6"
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView6"
|
app:layout_constraintStart_toStartOf="@+id/textView6"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/editTextTextEmailAddress2" />
|
app:layout_constraintTop_toBottomOf="@+id/editTextTextPassword" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="34dp"
|
|
||||||
android:layout_marginEnd="2dp"
|
|
||||||
android:text="Please enter your email address."
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/editTextTextEmailAddress2"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/editTextTextEmailAddress2" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView6"
|
android:id="@+id/textView6"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
android:text=""
|
android:text=""
|
||||||
app:layout_constraintBottom_toTopOf="@+id/button1"
|
app:layout_constraintBottom_toTopOf="@+id/button1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="46dp"
|
||||||
|
android:layout_marginEnd="2dp"
|
||||||
|
android:text="Please enter your email address."
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/editTextTextEmailAddress"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/editTextTextEmailAddress" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Reference in New Issue
Block a user