LoginActivity password max length

This commit is contained in:
Balazs Toldi 2023-07-29 15:37:44 +02:00
parent 442310cad3
commit 20c317b63f
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
2 changed files with 5 additions and 4 deletions

View File

@ -139,9 +139,9 @@ public class LoginActivity extends BaseActivity {
Log.i("LoginActivity", "Login button clicked");
loginButton.setEnabled(false);
progressBar.setVisibility(ProgressBar.VISIBLE);
String username = username_input.getText().toString();
String instance = correctURL(instance_input.getText().toString());
if(!Patterns.WEB_URL.matcher(instance).matches()){
String username = username_input.getText().toString().trim();
String instance = correctURL(instance_input.getText().toString().trim());
if (!Patterns.WEB_URL.matcher(instance).matches()) {
instance_input.setError("Invalid instance URL");
Toast.makeText(LoginActivity.this, "Invalid instance URL", Toast.LENGTH_SHORT).show();
loginButton.setEnabled(true);
@ -149,7 +149,7 @@ public class LoginActivity extends BaseActivity {
return;
}
Log.i("LoginActivity", "Instance: " + instance);
AccountLoginDTO accountLoginDTO = new AccountLoginDTO(username,password_input.getText().toString(),token_2fa_input.getText().toString());
AccountLoginDTO accountLoginDTO = new AccountLoginDTO(username, password_input.getText().toString(), token_2fa_input.getText().toString());
mRetrofit.setBaseURL(instance);
LemmyAPI api = mRetrofit.getRetrofit().create(LemmyAPI.class);
Call<String> accessTokenCall = api.userLogin(accountLoginDTO);

View File

@ -90,6 +90,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/user_password"
android:maxLength="60"
android:maxLines="1"
android:password="true" />