Add Forgot Password Option in LoginActivity (#1242)

* Add Forgot Password Option in LoginActivity

* Add Forgot Password Option in LoginActivity

* Add Forgot Password Option in LoginActivity

* Update URL for the "beta" flavor

* Update forgotPassword function
This commit is contained in:
Madhur Gupta 2018-03-10 23:00:05 +05:30 committed by Vivek Maskara
parent 57bfb7b328
commit de673eb4ca
7 changed files with 56 additions and 8 deletions

View file

@ -8,6 +8,7 @@ import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull;
@ -27,6 +28,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
@ -44,6 +46,7 @@ import fr.free.nrw.commons.contributions.ContributionsActivity;
import fr.free.nrw.commons.di.ApplicationlessInjection;
import fr.free.nrw.commons.mwapi.MediaWikiApi;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
import fr.free.nrw.commons.ui.widget.HtmlTextView;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -73,7 +76,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
@BindView(R.id.error_message_container) ViewGroup errorMessageContainer;
@BindView(R.id.error_message) TextView errorMessage;
@BindView(R.id.login_credentials) TextView loginCredentials;
@BindView(R.id.two_factor_container)TextInputLayout twoFactorContainer;
@BindView(R.id.two_factor_container) TextInputLayout twoFactorContainer;
@BindView(R.id.forgotPassword) HtmlTextView forgotPasswordText;
ProgressDialog progressDialog;
private AppCompatDelegate delegate;
private LoginTextWatcher textWatcher = new LoginTextWatcher();
@ -114,6 +119,8 @@ public class LoginActivity extends AccountAuthenticatorActivity {
loginButton.setOnClickListener(view -> performLogin());
signupButton.setOnClickListener(view -> signUp());
forgotPasswordText.setOnClickListener(view -> forgotPassword());
if(BuildConfig.FLAVOR == "beta"){
loginCredentials.setText(getString(R.string.login_credential));
} else {
@ -121,6 +128,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
}
}
private void forgotPassword() {
Utils.handleWebUrl(this, Uri.parse(BuildConfig.FORGOT_PASSWORD_URL));
}
public void hideKeyboard(View view) {
InputMethodManager inputMethodManager =(InputMethodManager)this.getSystemService(Activity.INPUT_METHOD_SERVICE);