コード例 #1
0
 private String createUnsubscribeUrl(String email, Notification notification) {
   StringBuilder sb = new StringBuilder();
   String baseUrl = systemConfig.getUrl();
   sb.append(baseUrl);
   if (!baseUrl.endsWith("/")) sb.append("/");
   sb.append("unsubscribe");
   sb.append("?email=").append(Str.encodeUrlParameter(email));
   if (notification.subject != null)
     sb.append("&subject=").append(Str.encodeUrlParameter(notification.subject.getId()));
   sb.append("&key=").append(Str.encodeUrlParameter(createKey(email)));
   return sb.toString();
 }
コード例 #2
0
 private String createText(String email, Notification notification) {
   String text = notification.project.getSubscriberNotificationTemplate();
   if (notification.subject instanceof ReferenceSupport) {
     text =
         text.replace(
             "${entity.reference}", ((ReferenceSupport) notification.subject).getReference());
   }
   if (notification.subject instanceof LabelSupport) {
     text = text.replace("${entity.label}", ((LabelSupport) notification.subject).getLabel());
   }
   text = text.replace("${change.message}", notification.message);
   text = text.replace("${project.label}", notification.project.getLabel());
   text = text.replace("${project.id}", notification.project.getId());
   if (notification.project.isProductLabelSet())
     text = text.replace("${product.label}", notification.project.getProductLabel());
   if (notification.project.isHomepageUrlSet())
     text = text.replace("${homepage.url}", notification.project.getHomepageUrl());
   text = text.replace("${unsubscribe.url}", createUnsubscribeUrl(email, notification));
   text = text.replace("${unsubscribeall.url}", createUnsubscribeUrl(email, notification));
   text = text.replace("${kunagi.instance}", systemConfig.getInstanceNameWithApplicationLabel());
   text = text.replace("${kunagi.url}", systemConfig.getUrl());
   return text;
 }
コード例 #3
0
ファイル: ScrumServiceImpl.java プロジェクト: MathesBo/kunagi
 @Override
 public void onTestLdap(GwtConversation conversation) {
   SystemConfig config = webApplication.getSystemConfig();
   try {
     Ldap.authenticateUserGetEmail(
         config.getLdapUrl(),
         config.getLdapUser(),
         config.getLdapPassword(),
         config.getLdapBaseDn(),
         config.getLdapUserFilterRegex(),
         "dummyUser",
         "dummyPassword");
   } catch (AuthenticationFailedException ex) {
   }
 }
コード例 #4
0
ファイル: ScrumServiceImpl.java プロジェクト: MathesBo/kunagi
 private void onSystemConfigChanged(
     GwtConversation conversation, SystemConfig config, Map properties) {
   if (properties.containsKey("url")) {
     webApplication.getConfig().setUrl(config.getUrl());
   }
 }
コード例 #5
0
 private String createKey(String email) {
   return PasswordHasher.hashPassword(email, systemConfig.getSubscriptionKeySeed());
 }