diff options
-rw-r--r-- | AndroidManifest.xml | 4 | ||||
-rw-r--r-- | res/layout/basic_settings.xml | 47 | ||||
-rw-r--r-- | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/BasicSettings.java | 10 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 16 |
5 files changed, 50 insertions, 28 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 91c93336..b7b7d198 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,11 +18,11 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.blinkt.openvpn" android:versionCode="8" - android:versionName="0.0.4" > + android:versionName="0.0.4a" > <uses-permission android:name="android.permission.INTERNET" /> - <uses-sdk android:minSdkVersion="14" /> + <uses-sdk android:minSdkVersion="15" /> <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> --> diff --git a/res/layout/basic_settings.xml b/res/layout/basic_settings.xml index f6673491..37d2c733 100644 --- a/res/layout/basic_settings.xml +++ b/res/layout/basic_settings.xml @@ -33,11 +33,7 @@ <EditText android:id="@+id/profilename" style="@style/item" - android:inputType="text" - /> - - - + android:inputType="text" /> <TextView style="@style/item" @@ -52,7 +48,7 @@ <!-- <requestFocus /> --> </EditText> - + <TextView style="@style/item" android:text="@string/port" @@ -113,7 +109,7 @@ </LinearLayout> <LinearLayout - android:id="@+id/certs" + android:id="@+id/cacert" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" @@ -124,6 +120,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" blinkt:title="@string/ca_title" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/certs" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone" > <de.blinkt.openvpn.FileSelectLayout android:id="@+id/certselect" @@ -166,56 +170,55 @@ android:inputType="textPassword" /> </LinearLayout> - <LinearLayout + <LinearLayout android:id="@+id/userpassword" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone" > - - <TextView + + <TextView style="@style/item" android:layout_marginLeft="8dip" android:layout_marginRight="8dip" android:text="@string/auth_username" android:textAppearance="?android:attr/textAppearanceSmall" /> - <EditText android:id="@+id/auth_username" style="@style/item" android:layout_marginLeft="8dip" android:layout_marginRight="8dip" - android:inputType="textNoSuggestions" /> - <TextView + android:inputType="textNoSuggestions" /> + + <TextView style="@style/item" android:layout_marginLeft="8dip" android:layout_marginRight="8dip" android:text="@string/auth_pwquery" android:textAppearance="?android:attr/textAppearanceSmall" /> - <EditText android:id="@+id/auth_password" style="@style/item" android:layout_marginLeft="8dip" android:layout_marginRight="8dip" android:inputType="textPassword" /> -</LinearLayout> + <!-- android:hint="@string/pw_query_hint" --> + </LinearLayout> + <LinearLayout android:id="@+id/statickeys" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone" > - <TextView android:text="@string/static_keys_info" - style="@style/item"/> - </LinearLayout> - - - - + <TextView + style="@style/item" + android:singleLine="false" + android:text="@string/static_keys_info" /> + </LinearLayout> </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index a837840e..2a2135a3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -103,4 +103,5 @@ <string name="config_error_message">An error has been found in your VPN configuration:</string> <string name="ipv4_format_error">Cannot parse the IPv4 address</string> <string name="custom_route_format_error">Cannot parse the custom routes</string> + <string name="pw_query_hint">Leave empty to query on demand</string> </resources> diff --git a/src/de/blinkt/openvpn/BasicSettings.java b/src/de/blinkt/openvpn/BasicSettings.java index 7c39eb94..51a4c2bc 100644 --- a/src/de/blinkt/openvpn/BasicSettings.java +++ b/src/de/blinkt/openvpn/BasicSettings.java @@ -173,10 +173,12 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI mView.findViewById(R.id.certs).setVisibility(View.GONE); mView.findViewById(R.id.statickeys).setVisibility(View.GONE); mView.findViewById(R.id.keystore).setVisibility(View.GONE); + mView.findViewById(R.id.cacert).setVisibility(View.GONE); switch(type) { case VpnProfile.TYPE_CERTIFICATES: mView.findViewById(R.id.certs).setVisibility(View.VISIBLE); + mView.findViewById(R.id.cacert).setVisibility(View.VISIBLE); break; case VpnProfile.TYPE_PKCS12: mView.findViewById(R.id.pkcs12).setVisibility(View.VISIBLE); @@ -190,6 +192,8 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI case VpnProfile.TYPE_USERPASS: mView.findViewById(R.id.userpassword).setVisibility(View.VISIBLE); + mView.findViewById(R.id.cacert).setVisibility(View.VISIBLE); + break; } @@ -208,7 +212,9 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI mType.setSelection(mProfile.mAuthenticationType); mpkcs12.setData(mProfile.mPKCS12Filename); mPKCS12Password.setText(mProfile.mPKCS12Password); - + mUserName.setText(mProfile.mUsername); + mPassword.setText(mProfile.mPassword); + setAlias(); } @@ -229,6 +235,8 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI mProfile.mPKCS12Filename = mpkcs12.getData(); mProfile.mPKCS12Password = mPKCS12Password.getText().toString(); + mProfile.mPassword = mPassword.getText().toString(); + mProfile.mUsername = mUserName.getText().toString(); } diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 2df4ec39..201bc111 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -70,8 +70,8 @@ public class VpnProfile implements Serializable{ public boolean mCheckRemoteCN=false; public boolean mExpectTLSCert=true; public String mRemoteCN=""; - private String mPassword; - private String mUsername; + public String mPassword=""; + public String mUsername=""; public boolean mRoutenopull=false; @@ -225,6 +225,13 @@ public class VpnProfile implements Serializable{ cfg+="\n"; cfg+="management-query-passwords\n"; break; + case VpnProfile.TYPE_USERPASS: + cfg+="ca " + mCaFilename + "\n"; + cfg+="auth-user-pass\n"; + cfg+="management-query-passwords\n"; + break; + + } @@ -233,7 +240,10 @@ public class VpnProfile implements Serializable{ } if(mUseTLSAuth) { - cfg+="tls-auth "; + if(mAuthenticationType==TYPE_STATICKEYS) + cfg+="static "; + else + cfg+="tls-auth "; cfg+=mTLSAuthFilename; cfg+=" "; cfg+= mTLSAuthDirection; |