mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
added mailing class
This commit is contained in:
@@ -10,10 +10,10 @@ import org.apache.wicket.request.UrlRenderer;
|
||||
import org.apache.wicket.request.cycle.RequestCycle;
|
||||
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||
|
||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
||||
import com.commafeed.backend.dao.UserDAO;
|
||||
import com.commafeed.backend.feeds.OPMLImporter;
|
||||
import com.commafeed.backend.model.ApplicationSettings;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.commafeed.frontend.utils.WicketUtils;
|
||||
import com.commafeed.frontend.utils.exception.DisplayException;
|
||||
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
|
||||
@@ -33,7 +33,7 @@ public class GoogleImportCallbackPage extends WebPage {
|
||||
private static final String EXPORT_URL = "https://www.google.com/reader/subscriptions/export";
|
||||
|
||||
@Inject
|
||||
ApplicationSettingsDAO applicationSettingsDAO;
|
||||
ApplicationSettingsService applicationSettingsService;
|
||||
|
||||
@Inject
|
||||
OPMLImporter importer;
|
||||
@@ -65,7 +65,7 @@ public class GoogleImportCallbackPage extends WebPage {
|
||||
} else if (code == null) {
|
||||
throw new DisplayException("Missing authorization code");
|
||||
} else {
|
||||
ApplicationSettings settings = applicationSettingsDAO.get();
|
||||
ApplicationSettings settings = applicationSettingsService.get();
|
||||
String redirectUri = getCallbackUrl();
|
||||
String clientId = settings.getGoogleClientId();
|
||||
String clientSecret = settings.getGoogleClientSecret();
|
||||
@@ -90,8 +90,7 @@ public class GoogleImportCallbackPage extends WebPage {
|
||||
httpRequest, accessToken);
|
||||
String opml = httpRequest.execute().parseAsString();
|
||||
String state = responseUrl.getState();
|
||||
importer.importOpml(userDAO.findById(Long.valueOf(state)),
|
||||
opml);
|
||||
importer.importOpml(userDAO.findById(Long.valueOf(state)), opml);
|
||||
} catch (Exception e) {
|
||||
throw new DisplayException(e);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.request.flow.RedirectToUrlException;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
||||
import com.commafeed.backend.model.ApplicationSettings;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.commafeed.frontend.CommaFeedSession;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@@ -23,11 +23,11 @@ public class GoogleImportRedirectPage extends WebPage {
|
||||
private static final String AUTH_URL = "https://accounts.google.com/o/oauth2/auth";
|
||||
|
||||
@Inject
|
||||
ApplicationSettingsDAO applicationSettingsDAO;
|
||||
ApplicationSettingsService applicationSettingsService;
|
||||
|
||||
public GoogleImportRedirectPage() {
|
||||
|
||||
ApplicationSettings settings = applicationSettingsDAO.get();
|
||||
ApplicationSettings settings = applicationSettingsService.get();
|
||||
|
||||
String clientId = settings.getGoogleClientId();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import javax.inject.Inject;
|
||||
import org.apache.wicket.markup.head.IHeaderResponse;
|
||||
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
||||
|
||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.commafeed.frontend.pages.components.LoginPanel;
|
||||
import com.commafeed.frontend.pages.components.RegisterPanel;
|
||||
import com.commafeed.frontend.utils.WicketUtils;
|
||||
@@ -14,7 +14,7 @@ import com.commafeed.frontend.utils.WicketUtils;
|
||||
public class WelcomePage extends BasePage {
|
||||
|
||||
@Inject
|
||||
ApplicationSettingsDAO applicationSettingsDAO;
|
||||
ApplicationSettingsService applicationSettingsService;
|
||||
|
||||
public WelcomePage() {
|
||||
add(new BookmarkablePageLink<Void>("logo-link", getApplication()
|
||||
@@ -24,7 +24,7 @@ public class WelcomePage extends BasePage {
|
||||
@Override
|
||||
protected void onConfigure() {
|
||||
super.onConfigure();
|
||||
setVisibilityAllowed(applicationSettingsDAO.get()
|
||||
setVisibilityAllowed(applicationSettingsService.get()
|
||||
.isAllowRegistrations());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,10 +20,10 @@ import org.apache.wicket.validation.IValidator;
|
||||
import org.apache.wicket.validation.ValidationError;
|
||||
import org.apache.wicket.validation.validator.StringValidator;
|
||||
|
||||
import com.commafeed.backend.dao.ApplicationSettingsDAO;
|
||||
import com.commafeed.backend.dao.UserDAO;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.model.UserRole.Role;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.commafeed.backend.services.UserService;
|
||||
import com.commafeed.frontend.CommaFeedSession;
|
||||
import com.commafeed.frontend.model.RegistrationRequest;
|
||||
@@ -40,7 +40,7 @@ public class RegisterPanel extends Panel {
|
||||
UserService userService;
|
||||
|
||||
@Inject
|
||||
ApplicationSettingsDAO applicationSettingsDAO;
|
||||
ApplicationSettingsService applicationSettingsService;
|
||||
|
||||
public RegisterPanel(String markupId) {
|
||||
super(markupId);
|
||||
@@ -51,7 +51,7 @@ public class RegisterPanel extends Panel {
|
||||
"form", model) {
|
||||
@Override
|
||||
protected void onSubmit() {
|
||||
if (applicationSettingsDAO.get().isAllowRegistrations()) {
|
||||
if (applicationSettingsService.get().isAllowRegistrations()) {
|
||||
RegistrationRequest req = getModelObject();
|
||||
userService.register(req.getName(), req.getPassword(),
|
||||
Arrays.asList(Role.USER));
|
||||
|
||||
Reference in New Issue
Block a user