mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f7eb17fd94 | |||
27990d56e9 | |||
6d56c7f803 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
/app/release/
|
||||
|
@ -10,8 +10,8 @@ android {
|
||||
applicationId "app.fedilab.fedilabtube"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 5
|
||||
versionName "1.0.3"
|
||||
versionCode 6
|
||||
versionName "1.0.4"
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -43,7 +43,7 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'com.google.android.material:material:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
||||
implementation "androidx.fragment:fragment:1.2.5"
|
||||
@ -52,8 +52,8 @@ dependencies {
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.browser:browser:1.2.0'
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
||||
implementation 'com.github.GrenderG:Toasty:1.4.2'
|
||||
|
@ -219,9 +219,9 @@ public class LoginActivity extends AppCompatActivity {
|
||||
parameters.put(Helper.CLIENT_SECRET, sharedpreferences.getString(Helper.CLIENT_SECRET, null));
|
||||
parameters.put("grant_type", "password");
|
||||
try {
|
||||
parameters.put("username", URLEncoder.encode(login_uid.getText().toString().trim().toLowerCase(), "UTF-8"));
|
||||
parameters.put("username", URLEncoder.encode(login_uid.getText().toString().trim(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
parameters.put("username", login_uid.getText().toString().trim().toLowerCase());
|
||||
parameters.put("username", login_uid.getText().toString().trim());
|
||||
}
|
||||
try {
|
||||
parameters.put("password", URLEncoder.encode(login_passwd.getText().toString(), "UTF-8"));
|
||||
|
@ -17,17 +17,21 @@ package app.fedilab.fedilabtube;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Patterns;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import app.fedilab.fedilabtube.asynctasks.CreatePeertubeAccountAsyncTask;
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
@ -55,16 +59,53 @@ public class PeertubeRegisterActivity extends AppCompatActivity implements OnPos
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
signup = findViewById(R.id.signup);
|
||||
EditText username = findViewById(R.id.username);
|
||||
EditText email = findViewById(R.id.email);
|
||||
EditText password = findViewById(R.id.password);
|
||||
EditText password_confirm = findViewById(R.id.password_confirm);
|
||||
TextInputEditText username = findViewById(R.id.username);
|
||||
TextInputEditText email = findViewById(R.id.email);
|
||||
TextInputEditText password = findViewById(R.id.password);
|
||||
TextInputEditText password_confirm = findViewById(R.id.password_confirm);
|
||||
CheckBox agreement = findViewById(R.id.agreement);
|
||||
error_message = findViewById(R.id.error_message);
|
||||
|
||||
|
||||
username.setOnFocusChangeListener((view, focused) -> {
|
||||
if (!focused && username.getText() != null) {
|
||||
Pattern patternUsername = Pattern.compile("^[a-z0-9._]{1,50}$");
|
||||
Matcher matcherMaxId = patternUsername.matcher(username.getText().toString());
|
||||
if (!matcherMaxId.matches()) {
|
||||
username.setError(getString(R.string.username_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
email.setOnFocusChangeListener((view, focused) -> {
|
||||
if (!focused && email.getText() != null) {
|
||||
Pattern patternUsername = Patterns.EMAIL_ADDRESS;
|
||||
Matcher matcherMaxId = patternUsername.matcher(email.getText().toString());
|
||||
if (!matcherMaxId.matches()) {
|
||||
email.setError(getString(R.string.email_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
password.setOnFocusChangeListener((view, focused) -> {
|
||||
if (!focused && password.getText() != null) {
|
||||
if (password.getText().length() < 6) {
|
||||
password.setError(getString(R.string.password_length_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
password_confirm.setOnFocusChangeListener((view, focused) -> {
|
||||
if (!focused && password_confirm.getText() != null && password.getText() != null) {
|
||||
if (password_confirm.getText().toString().compareTo(password.getText().toString()) != 0) {
|
||||
password_confirm.setError(getString(R.string.password));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
signup.setOnClickListener(view -> {
|
||||
error_message.setVisibility(View.GONE);
|
||||
if (username.getText().toString().trim().length() == 0 || email.getText().toString().trim().length() == 0 ||
|
||||
if (username.getText() == null || email.getText() == null || password.getText() == null || password_confirm.getText() == null || username.getText().toString().trim().length() == 0 || email.getText().toString().trim().length() == 0 ||
|
||||
password.getText().toString().trim().length() == 0 || password_confirm.getText().toString().trim().length() == 0 || !agreement.isChecked()) {
|
||||
Toasty.error(PeertubeRegisterActivity.this, getString(R.string.all_field_filled)).show();
|
||||
return;
|
||||
@ -101,6 +142,7 @@ public class PeertubeRegisterActivity extends AppCompatActivity implements OnPos
|
||||
accountCreation.setPassword(password.getText().toString().trim());
|
||||
accountCreation.setPasswordConfirm(password_confirm.getText().toString().trim());
|
||||
accountCreation.setUsername(username.getText().toString().trim());
|
||||
accountCreation.setInstance(instance);
|
||||
new CreatePeertubeAccountAsyncTask(PeertubeRegisterActivity.this, accountCreation, Helper.getPeertubeUrl(instance), PeertubeRegisterActivity.this).executeOnExecutor(THREAD_POOL_EXECUTOR);
|
||||
});
|
||||
|
||||
|
@ -838,7 +838,7 @@ public class PeertubeAPI {
|
||||
params.put("username", accountCreation.getUsername());
|
||||
params.put("email", accountCreation.getEmail());
|
||||
params.put("password", accountCreation.getPassword());
|
||||
new HttpsConnection(context).post(getAbsoluteUrl("/users/register"), 30, params, null);
|
||||
new HttpsConnection(context).post(getAbsoluteUrlForInstance(accountCreation.getInstance(), "/users/register"), 30, params, null);
|
||||
apiResponse.setStringData(accountCreation.getEmail());
|
||||
} catch (NoSuchAlgorithmException | IOException | KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
@ -920,7 +920,6 @@ public class PeertubeAPI {
|
||||
* @param accountId String account fetched
|
||||
* @return Account entity
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public Account getAccount(String accountId) {
|
||||
|
||||
account = new Account();
|
||||
@ -2074,6 +2073,11 @@ public class PeertubeAPI {
|
||||
return Helper.instanceWithProtocol(context) + "/api/v1" + action;
|
||||
}
|
||||
|
||||
|
||||
private String getAbsoluteUrlForInstance(String instance, String action) {
|
||||
return "https://" + instance + "/api/v1" + action;
|
||||
}
|
||||
|
||||
public enum reportType {
|
||||
ACCOUNT,
|
||||
COMMENT,
|
||||
|
@ -22,6 +22,7 @@ public class AccountCreation {
|
||||
private String email;
|
||||
private String password;
|
||||
private String passwordConfirm;
|
||||
private String instance;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
@ -62,4 +63,12 @@ public class AccountCreation {
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setInstance(String instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,12 @@
|
||||
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
@ -64,14 +69,18 @@
|
||||
android:labelFor="@+id/username"
|
||||
android:text="@string/username" />
|
||||
|
||||
<EditText
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/username_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:errorEnabled="true">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:maxLength="30"
|
||||
android:singleLine="true" />
|
||||
android:maxLength="50" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username_indicator"
|
||||
@ -86,13 +95,17 @@
|
||||
android:labelFor="@+id/email"
|
||||
android:text="@string/email" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/email"
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/email_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textEmailAddress"
|
||||
android:singleLine="true" />
|
||||
app:errorEnabled="true">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
@ -107,13 +120,19 @@
|
||||
android:labelFor="@+id/password"
|
||||
android:text="@string/password" />
|
||||
|
||||
<EditText
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:errorEnabled="true">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
android:inputType="textPassword" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
@ -128,13 +147,19 @@
|
||||
android:labelFor="@+id/password_confirm"
|
||||
android:text="@string/password_confirm" />
|
||||
|
||||
<EditText
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/password_confirm_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:errorEnabled="true">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/password_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
android:inputType="textPassword" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -160,4 +185,5 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sign_up" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
@ -134,6 +134,7 @@
|
||||
<string name="account_created">Compte créé !</string>
|
||||
<string name="account_created_message">Votre compte est créé !\n\nVous allez recevoir un email de confirmation à l\'adresse <b>%1$s</b>.\n\nCliquez sur le lien présent dans le mail pour valider votre compte.</string>
|
||||
<string name="all_field_filled">Veuillez remplir tous les champs !</string>
|
||||
<string name="password_length_error">Le mot de passe doit contenir 6 caractères !</string>
|
||||
<string name="password_error">Les mots de passe ne sont pas identiques !</string>
|
||||
<string name="email_error">L\'e-mail ne semble pas être valide !</string>
|
||||
<string name="password_too_short">Le mot de passe doit contenir au moins 8 caractères</string>
|
||||
|
4
fastlane/metadata/android/en-US/changelogs/5.txt
Normal file
4
fastlane/metadata/android/en-US/changelogs/5.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Corrections :
|
||||
|
||||
- Problème lors de la création d'un compte
|
||||
- Impossibilité de se connecter avec des comptes ayant des majuscules dans l'email
|
Reference in New Issue
Block a user