diff --git a/src/main/java/org/ntlab/acanthus_server/entities/Account.java b/src/main/java/org/ntlab/acanthus_server/entities/Account.java index 0f911e4..127c775 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Account.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Account.java @@ -67,8 +67,8 @@ //----------------------------------------------------------------- //コンストラクト - public Account() { - createDummyAccount(); + public Account(Integer idMargin) { + createDummyAccount(idMargin); } //----------------------------------------------------------------- @@ -171,30 +171,32 @@ public boolean isMatchedPassword(String password) { return this.password.equals(password); } + //----------------------------------------------------------------- // トークンのチェック - public boolean isCollectToken(String token){ + public boolean isCollectToken(String token) { var timeoutThreshold = 3; var nowDateTime = LocalDateTime.now(); - if(lastAccess==null) lastAccess = nowDateTime; + if (lastAccess == null) lastAccess = nowDateTime; // 時刻比較 var duration = Duration.between(lastAccess, nowDateTime).toHours(); - if(duration > timeoutThreshold) return false; + if (duration > timeoutThreshold) return false; return token.equals(this.token); } + //----------------------------------------------------------------- //----------------------------------------------------------------- // ダミー - private void createDummyAccount() { + private void createDummyAccount(Integer idMargin) { this.isDummy = true; - this.uid = 1; - this.name = "dummy"; - this.email = "d@dummy.com"; + this.uid = 1 + idMargin; + this.name = "dummy" + idMargin.toString(); + this.email = "d" + idMargin.toString() + "@dummy.com"; this.password = "nittalab"; - this.token = "abc"; + this.token = "abc" + idMargin.toString(); this.lastAccess = LocalDateTime.now(); //this.lastAccess = LocalDateTime.of(2015, 12, 15, 0, 0);