diff --git a/primitiveFTPd/src/org/primftpd/PrimitiveFtpdActivity.java b/primitiveFTPd/src/org/primftpd/PrimitiveFtpdActivity.java index fe3356f1..1bdadca4 100644 --- a/primitiveFTPd/src/org/primftpd/PrimitiveFtpdActivity.java +++ b/primitiveFTPd/src/org/primftpd/PrimitiveFtpdActivity.java @@ -632,7 +632,7 @@ protected void handleStart() { handleStart(null, null); } protected void handleStart(MenuItem startIcon, MenuItem stopIcon) { - if (StringUtils.isBlank(prefsBean.getPassword())) + if (!isPasswordOk()) { Toast.makeText( getApplicationContext(), @@ -691,6 +691,15 @@ protected void handlePrefs() { startActivity(intent); } + protected boolean isPasswordOk() { + if (!prefsBean.getServerToStart().isPasswordMandatory() + && prefsBean.isPubKeyAuth()) + { + return true; + } + return !StringUtils.isBlank(prefsBean.getPassword()); + } + /** * @return Intent to start/stop {@link FtpServerService}. */ diff --git a/primitiveFTPd/src/org/primftpd/prefs/ServerToStart.java b/primitiveFTPd/src/org/primftpd/prefs/ServerToStart.java index 34bb9326..9501c245 100644 --- a/primitiveFTPd/src/org/primftpd/prefs/ServerToStart.java +++ b/primitiveFTPd/src/org/primftpd/prefs/ServerToStart.java @@ -25,6 +25,10 @@ public boolean startFtp() { public boolean startSftp() { return true; } + @Override + public boolean isPasswordMandatory() { + return false; + } }, ALL("0") { @Override @@ -60,4 +64,7 @@ public static ServerToStart byXmlVal(String xmlVal) { public abstract boolean startFtp(); public abstract boolean startSftp(); + public boolean isPasswordMandatory() { + return true; + } }