-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f385fe6
commit 5ff7a83
Showing
10 changed files
with
163 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 20 additions & 30 deletions
50
src/jp/dogrun/ileaflet/controller/login/RegisterController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/jp/dogrun/ileaflet/controller/validator/login/RegisterValidators.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package jp.dogrun.ileaflet.controller.validator.login; | ||
|
||
import java.util.Map; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.slim3.controller.validator.Validators; | ||
|
||
public class RegisterValidators extends Validators { | ||
|
||
public RegisterValidators(HttpServletRequest request) { | ||
super(request); | ||
} | ||
|
||
public RegisterValidators(Map<String, Object> parameters) | ||
throws NullPointerException { | ||
super(parameters); | ||
} | ||
|
||
public SamePasswordValidator samePassword() { | ||
return SamePasswordValidator.INSTANCE; | ||
} | ||
|
||
public SameActorValidator sameUser() { | ||
return SameActorValidator.INSTANCE; | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
src/jp/dogrun/ileaflet/controller/validator/login/SameActorValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package jp.dogrun.ileaflet.controller.validator.login; | ||
|
||
import java.util.Map; | ||
|
||
import jp.dogrun.ileaflet.dao.ActorDao; | ||
import jp.dogrun.ileaflet.model.Actor; | ||
|
||
import org.slim3.controller.validator.AbstractValidator; | ||
import org.slim3.util.ApplicationMessage; | ||
|
||
public class SameActorValidator extends AbstractValidator { | ||
|
||
public static SameActorValidator INSTANCE = new SameActorValidator(); | ||
public SameActorValidator() { | ||
} | ||
|
||
public SameActorValidator(String message) { | ||
super(message); | ||
} | ||
|
||
public String validate(Map<String, Object> parameters, String name) { | ||
String identity = (String)parameters.get("identity"); | ||
String mail = (String)parameters.get("mail"); | ||
|
||
ActorDao dao = new ActorDao(); | ||
Actor actor = dao.findById(identity); | ||
if ( actor != null ) { | ||
if (message != null) { | ||
return message; | ||
} | ||
return ApplicationMessage.get("validator.sameIdentity", getLabel("identity")); | ||
} | ||
|
||
actor = dao.findByMail(mail); | ||
if ( actor != null ){ | ||
if (message != null) { | ||
return message; | ||
} | ||
return ApplicationMessage.get("validator.sameMail", getLabel("mail")); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected String getMessageKey() { | ||
return "validator.sameActor"; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
src/jp/dogrun/ileaflet/controller/validator/login/SamePasswordValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package jp.dogrun.ileaflet.controller.validator.login; | ||
|
||
import java.util.Map; | ||
|
||
import org.slim3.controller.validator.AbstractValidator; | ||
import org.slim3.util.ApplicationMessage; | ||
|
||
public class SamePasswordValidator extends AbstractValidator { | ||
|
||
public static SamePasswordValidator INSTANCE = new SamePasswordValidator(); | ||
public SamePasswordValidator() { | ||
super(); | ||
} | ||
|
||
public SamePasswordValidator(String message) { | ||
super(message); | ||
} | ||
|
||
public String validate(Map<String, Object> parameters, String name) { | ||
Object value1 = parameters.get("password"); | ||
Object value2 = parameters.get("password2"); | ||
if ( value1 != null && | ||
!value1.equals(value2) ) { | ||
if (message != null) { | ||
return message; | ||
} | ||
return ApplicationMessage.get(getMessageKey(), getLabel(name)); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected String getMessageKey() { | ||
return "validator.samePassword"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!-- Indices written at Sat, 30 May 2009 05:54:22 UTC --> | ||
<!-- Indices written at Thu, 17 Jan 2013 10:03:34 UTC --> | ||
|
||
<datastore-indexes/> | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters