Commit 5edc7403 by Kazuyuki Hida

規約に同意しないときのログアウト時に、端末内に記憶されているログイン情報をクリアするようにした(ログイン済の場合を除く)。

parent a314d3e0
...@@ -57,6 +57,10 @@ public class AcmsDao extends AbstractDao { ...@@ -57,6 +57,10 @@ public class AcmsDao extends AbstractDao {
insert("insert into m_acms (url_path, acms_address,download_server_address, websocket_server_http_url, websocket_server_ws_url, schedulelist_last_fetch_date, contentversion_last_fetch_date) values (?,?,?,?,?,?,?)", acmsDto.getInsertValues()); insert("insert into m_acms (url_path, acms_address,download_server_address, websocket_server_http_url, websocket_server_ws_url, schedulelist_last_fetch_date, contentversion_last_fetch_date) values (?,?,?,?,?,?,?)", acmsDto.getInsertValues());
} }
public void deleteAcms() {
delete("m_acms", "", null);
}
public boolean isTodayLastAnnounceChangePasswordDate() { public boolean isTodayLastAnnounceChangePasswordDate() {
int ret = rawQueryGetInt("select COUNT(url_path) AS last_count from m_acms where last_announce_change_password_date=DATE('NOW','LOCALTIME')", null); int ret = rawQueryGetInt("select COUNT(url_path) AS last_count from m_acms where last_announce_change_password_date=DATE('NOW','LOCALTIME')", null);
return ret > 0; return ret > 0;
......
...@@ -352,6 +352,14 @@ public class ContractLogic extends AbstractLogic { ...@@ -352,6 +352,14 @@ public class ContractLogic extends AbstractLogic {
} }
} }
/**
* ログイン情報のアカウントパスを削除する
*/
public void deleteUrlPath() {
acmsDao.deleteAcms();
cache.setUrlPath(null);
}
public static boolean getBooleanValue(String value) { public static boolean getBooleanValue(String value) {
return True.equals(value); return True.equals(value);
} }
......
...@@ -83,7 +83,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -83,7 +83,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
AlertDialog dialog = AgreementToTermsHelper.getCurrentDialog(); AlertDialog dialog = AgreementToTermsHelper.getCurrentDialog();
if (dialog != null && dialog.isShowing()) { if (dialog != null && dialog.isShowing()) {
dialog.dismiss(); dialog.dismiss();
LogoutHelper.logout(this, false); LogoutHelper.logout(this, false, false);
} }
} }
...@@ -119,7 +119,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -119,7 +119,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
doShowMainActivity(); doShowMainActivity();
} else { } else {
// 規約に同意しなかったので、ログアウト // 規約に同意しなかったので、ログアウト
LogoutHelper.logout(ABVNoAuthenticatedActivity.this); LogoutHelper.logout(ABVNoAuthenticatedActivity.this, true, true);
} }
} }
...@@ -467,7 +467,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity { ...@@ -467,7 +467,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
doMoveToHome(); doMoveToHome();
} else { } else {
// 規約に同意しなかったので、ログアウト // 規約に同意しなかったので、ログアウト
LogoutHelper.logout(ABVNoAuthenticatedActivity.this); LogoutHelper.logout(ABVNoAuthenticatedActivity.this, false, true);
} }
} }
......
...@@ -6,8 +6,11 @@ import android.content.Intent; ...@@ -6,8 +6,11 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.widget.Toast; import android.widget.Toast;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic; import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
...@@ -27,7 +30,7 @@ public class LogoutHelper { ...@@ -27,7 +30,7 @@ public class LogoutHelper {
* @param activity 呼び出し元アクティビティ * @param activity 呼び出し元アクティビティ
*/ */
public static void logout(Activity activity) { public static void logout(Activity activity) {
logout(activity, true); logout(activity, false, true);
} }
/** /**
...@@ -36,7 +39,7 @@ public class LogoutHelper { ...@@ -36,7 +39,7 @@ public class LogoutHelper {
* @param activity 呼び出し元アクティビティ * @param activity 呼び出し元アクティビティ
* @param launchLogin trueならLoginActivityをstart * @param launchLogin trueならLoginActivityをstart
*/ */
public static void logout(Activity activity, boolean launchLogin) { public static void logout(Activity activity, boolean removeLoginInfo, boolean launchLogin) {
try { try {
// modify by Jang 2013.06.20 // modify by Jang 2013.06.20
UserAuthenticateLogic user = AbstractLogic.getLogic(UserAuthenticateLogic.class); UserAuthenticateLogic user = AbstractLogic.getLogic(UserAuthenticateLogic.class);
...@@ -60,6 +63,17 @@ public class LogoutHelper { ...@@ -60,6 +63,17 @@ public class LogoutHelper {
SharedPreferences sharedPreferences = activity.getSharedPreferences(AppDefType.PrefName.USER_PREFERENCE, Context.MODE_PRIVATE); SharedPreferences sharedPreferences = activity.getSharedPreferences(AppDefType.PrefName.USER_PREFERENCE, Context.MODE_PRIVATE);
sharedPreferences.edit().remove(AppDefType.UserPrefKey.GUEST_LOGIN).apply(); sharedPreferences.edit().remove(AppDefType.UserPrefKey.GUEST_LOGIN).apply();
boolean isLoginModePath = activity.getResources().getInteger(R.integer.login_mode) == LoginMode.PATH_ID_PASS;
boolean isLoginModeSite = activity.getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH_ID_PASS;
if (removeLoginInfo && (isLoginModePath || isLoginModeSite)) {
ContractLogic logic = AbstractLogic.getLogic(ContractLogic.class);
logic.deleteUrlPath();
}
if (removeLoginInfo && isLoginModeSite) {
ABVEnvironment.getInstance().acmsAddress = null;
}
if (launchLogin) { if (launchLogin) {
Intent intent = new Intent(activity, LoginActivity.class); Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment