Reworked MSC1915. Add request validation.
This commit is contained in:
@@ -115,24 +115,10 @@ public class EmailSendGridConfig {
|
||||
|
||||
public static class Templates {
|
||||
|
||||
public static class TemplateSessionUnbind {
|
||||
|
||||
private EmailTemplate fraudulent = new EmailTemplate();
|
||||
|
||||
public EmailTemplate getFraudulent() {
|
||||
return fraudulent;
|
||||
}
|
||||
|
||||
public void setFraudulent(EmailTemplate fraudulent) {
|
||||
this.fraudulent = fraudulent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class TemplateSession {
|
||||
|
||||
private EmailTemplate validation = new EmailTemplate();
|
||||
private TemplateSessionUnbind unbind = new TemplateSessionUnbind();
|
||||
private EmailTemplate unbind = new EmailTemplate();
|
||||
|
||||
public EmailTemplate getValidation() {
|
||||
return validation;
|
||||
@@ -142,11 +128,11 @@ public class EmailSendGridConfig {
|
||||
this.validation = validation;
|
||||
}
|
||||
|
||||
public TemplateSessionUnbind getUnbind() {
|
||||
public EmailTemplate getUnbind() {
|
||||
return unbind;
|
||||
}
|
||||
|
||||
public void setUnbind(TemplateSessionUnbind unbind) {
|
||||
public void setUnbind(EmailTemplate unbind) {
|
||||
this.unbind = unbind;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ public class EmailTemplateConfig extends GenericTemplateConfig {
|
||||
setInvite("classpath:/threepids/email/invite-template.eml");
|
||||
getGeneric().put("matrixId", "classpath:/threepids/email/mxid-template.eml");
|
||||
getSession().setValidation("classpath:/threepids/email/validate-template.eml");
|
||||
getSession().getUnbind().setFraudulent("classpath:/threepids/email/unbind-fraudulent.eml");
|
||||
getSession().getUnbind().setValidation("classpath:/threepids/email/unbind-template.eml");
|
||||
getSession().getUnbind().setNotification("classpath:/threepids/email/unbind-notification.eml");
|
||||
}
|
||||
|
||||
public EmailTemplateConfig build() {
|
||||
@@ -40,7 +41,8 @@ public class EmailTemplateConfig extends GenericTemplateConfig {
|
||||
log.info("Session:");
|
||||
log.info(" Validation: {}", getSession().getValidation());
|
||||
log.info(" Unbind:");
|
||||
log.info(" Fraudulent: {}", getSession().getUnbind().getFraudulent());
|
||||
log.info(" Validation: {}", getSession().getUnbind().getValidation());
|
||||
log.info(" Notification: {}", getSession().getUnbind().getNotification());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -41,16 +41,25 @@ public class GenericTemplateConfig {
|
||||
|
||||
public static class SessionUnbind {
|
||||
|
||||
private String fraudulent;
|
||||
private String validation;
|
||||
|
||||
public String getFraudulent() {
|
||||
return fraudulent;
|
||||
private String notification;
|
||||
|
||||
public String getValidation() {
|
||||
return validation;
|
||||
}
|
||||
|
||||
public void setFraudulent(String fraudulent) {
|
||||
this.fraudulent = fraudulent;
|
||||
public void setValidation(String validation) {
|
||||
this.validation = validation;
|
||||
}
|
||||
|
||||
public String getNotification() {
|
||||
return notification;
|
||||
}
|
||||
|
||||
public void setNotification(String notification) {
|
||||
this.notification = notification;
|
||||
}
|
||||
}
|
||||
|
||||
private String validation;
|
||||
|
||||
@@ -30,7 +30,8 @@ public class PhoneSmsTemplateConfig extends GenericTemplateConfig {
|
||||
public PhoneSmsTemplateConfig() {
|
||||
setInvite("classpath:/threepids/sms/invite-template.txt");
|
||||
getSession().setValidation("classpath:/threepids/sms/validate-template.txt");
|
||||
getSession().getUnbind().setFraudulent("classpath:/threepids/sms/unbind-fraudulent.txt");
|
||||
getSession().getUnbind().setValidation("classpath:/threepids/sms/unbind-validation.txt");
|
||||
getSession().getUnbind().setNotification("classpath:/threepids/sms/unbind-notification.txt");
|
||||
}
|
||||
|
||||
public PhoneSmsTemplateConfig build() {
|
||||
@@ -39,7 +40,8 @@ public class PhoneSmsTemplateConfig extends GenericTemplateConfig {
|
||||
log.info("Session:");
|
||||
log.info(" Validation: {}", getSession().getValidation());
|
||||
log.info(" Unbind:");
|
||||
log.info(" Fraudulent: {}", getSession().getUnbind().getFraudulent());
|
||||
log.info(" Validation: {}", getSession().getUnbind().getValidation());
|
||||
log.info(" Notification: {}", getSession().getUnbind().getNotification());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user