Skip to content

Commit

Permalink
NEW Hide Basic auth pass found into URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 13, 2023
1 parent af5963c commit 4225178
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ English DoliDroid ChangeLog
***** ChangeLog for 3.0 *****

3.0-b57
- NEW Hide Basic auth pass found into URLs
- NEW Add a page to manage favorites connections. Can remove one or all connections.
- Test to support for Google OAUTH2 openid connect to avoid to leave DoliDroid (support disabled by Google).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.regex.*;

import com.nltechno.utils.Utils;

Expand Down Expand Up @@ -213,7 +214,11 @@ public void onStart() {
String currentUrl = intent.getStringExtra("currentUrl");
String title = intent.getStringExtra("title");
if (currentUrl != null && ! "".equals(currentUrl)) {
s3+="<font color='#440066'><b>"+getString(R.string.currentUrl)+":</b></font><br /><br />\n"+title+"<br />\n"+currentUrl;
String pattern = "^(https?:https://[^:]+):[^@]+@";
Pattern regexPattern = Pattern.compile(pattern);
Matcher matcher = regexPattern.matcher(currentUrl);
String currentUrlWithoutPass = matcher.replaceFirst("$1:******@");
s3+="<font color='#440066'><b>"+getString(R.string.currentUrl)+":</b></font><br /><br />\n"+title+"<br />\n"+currentUrlWithoutPass;
}
String lastversionfound = intent.getStringExtra("lastversionfound");
if (lastversionfound != null && ! "".equals(lastversionfound)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ public void onStart() {
tmps += " ("+this.listOfRootUrl.get(i).getScheme();
if (! "".equals(this.listOfRootUrl.get(i).getBasicAuthLogin())) {
tmps += " - "+this.listOfRootUrl.get(i).getBasicAuthLogin();
tmps += ":"+this.listOfRootUrl.get(i).getBasicAuthPass();
//tmps += ":"+this.listOfRootUrl.get(i).getBasicAuthPass();
tmps += ":******";
}
tmps += ")";
adapter.add(tmps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public void onCreate(Bundle savedInstanceState) {
tmps += " ("+MainActivity.listOfRootUrl.get(count).getScheme();
if (! "".equals(MainActivity.listOfRootUrl.get(count).getBasicAuthLogin())) {
tmps += " - "+MainActivity.listOfRootUrl.get(count).getBasicAuthLogin();
tmps += ":"+MainActivity.listOfRootUrl.get(count).getBasicAuthPass();
//tmps += ":"+MainActivity.listOfRootUrl.get(count).getBasicAuthPass();
tmps += "******";
}
tmps += ")";

Expand All @@ -123,7 +124,7 @@ public void onCreate(Bundle savedInstanceState) {
listViewOfUrls.setAdapter(adapter);

// Update menu label to add the number of predefined URL into label
Button buttonClearAllUrl = findViewById(R.id.buttonClearAllUrl);
/*Button buttonClearAllUrl = findViewById(R.id.buttonClearAllUrl);
if (MainActivity.listOfRootUrl != null) {
buttonClearAllUrl.setText(getString(R.string.DeleteAllPredefinedUrl) + " (" + MainActivity.listOfRootUrl.size() + ")");
} else {
Expand Down Expand Up @@ -181,6 +182,7 @@ public void onClick(View v) {
}
}
});
*/
}


Expand Down Expand Up @@ -342,8 +344,9 @@ public void onStart() {
textViewListOfUrl.setVisibility(View.VISIBLE);
textViewListOfUrl2.setVisibility(View.VISIBLE);

Button btnClearAll = findViewById(R.id.buttonClearAllUrl);
/*Button btnClearAll = findViewById(R.id.buttonClearAllUrl);
btnClearAll.setVisibility(View.INVISIBLE);
*/
ListView listView = findViewById(R.id.listViewConnections);
listView.setVisibility(View.INVISIBLE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public void onClick(View v) {
tmps += " ("+MainActivity.listOfRootUrl.get(count).getScheme();
if (! "".equals(MainActivity.listOfRootUrl.get(count).getBasicAuthLogin())) {
tmps += " - "+MainActivity.listOfRootUrl.get(count).getBasicAuthLogin();
tmps += ":"+MainActivity.listOfRootUrl.get(count).getBasicAuthPass();
//tmps += ":"+MainActivity.listOfRootUrl.get(count).getBasicAuthPass();
tmps += ":******";
}
tmps += ")";

Expand Down
24 changes: 2 additions & 22 deletions app/src/main/res/layout/activity_manageurl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@
android:padding="4dp"
android:theme="@style/DoliDroidThemeFirst">

<Button
android:id="@+id/buttonClearAllUrl"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="13dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="14dp"
android:background="#009688"
android:paddingStart="8dp"
android:paddingTop="0dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
android:text="@string/DeleteAllPredefinedUrl"
android:textColor="@color/white"
android:textSize="14sp"
tools:ignore="TextContrastCheck,TouchTargetSizeCheck" />

<ImageView
android:id="@+id/imageTop"
android:layout_width="48dp"
Expand All @@ -55,12 +35,12 @@
android:id="@+id/listViewConnections"
android:layout_width="wrap_content"
android:layout_height="276dp"
android:layout_above="@id/buttonClearAllUrl"
android:layout_below="@id/textListOfUrlsTitle"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="16dp"
android:layout_marginBottom="14dp"
android:clickable="true"
android:focusable="true"
android:footerDividersEnabled="true"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.android.tools.build:gradle:8.1.0'
}
}

Expand Down

0 comments on commit 4225178

Please sign in to comment.