forked from Archives/Athou_commafeed
more styling
This commit is contained in:
@@ -6,12 +6,18 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="text-center">
|
||||||
|
<h1>CommaFeed</h1>
|
||||||
|
Bloat-free feed reader.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<h3>Login</h3>
|
<h3>Login</h3>
|
||||||
<span wicket:id="login"></span>
|
<span wicket:id="login"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="span6">
|
<div class="span6" wicket:enclosure="register">
|
||||||
<h3>Register</h3>
|
<h3>Register</h3>
|
||||||
<span wicket:id="register"></span>
|
<span wicket:id="register"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
package com.commafeed.frontend.pages;
|
package com.commafeed.frontend.pages;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import com.commafeed.backend.dao.ApplicationSettingsService;
|
||||||
import com.commafeed.frontend.pages.components.LoginPanel;
|
import com.commafeed.frontend.pages.components.LoginPanel;
|
||||||
import com.commafeed.frontend.pages.components.RegisterPanel;
|
import com.commafeed.frontend.pages.components.RegisterPanel;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class WelcomePage extends BasePage {
|
public class WelcomePage extends BasePage {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
public WelcomePage() {
|
public WelcomePage() {
|
||||||
add(new LoginPanel("login"));
|
add(new LoginPanel("login"));
|
||||||
add(new RegisterPanel("register"));
|
add(new RegisterPanel("register") {
|
||||||
|
@Override
|
||||||
|
protected void onConfigure() {
|
||||||
|
super.onConfigure();
|
||||||
|
setVisibilityAllowed(applicationSettingsService.get()
|
||||||
|
.isAllowRegistrations());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block" wicket:id="rememberMeRow">
|
<p class="help-block" wicket:id="rememberMeRow">
|
||||||
<input wicket:id="rememberMe" type="checkbox" /> Remember me
|
<label class="checkbox">
|
||||||
|
<input wicket:id="rememberMe" type="checkbox" />
|
||||||
|
Remember me
|
||||||
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<input type="submit" class="btn btn-primary" value="Log in" />
|
<input type="submit" class="btn btn-primary" value="Log in" />
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">Email address</label>
|
<label class="control-label">Email address (optional)</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="email" wicket:id="email"></input>
|
<input type="email" wicket:id="email"></input>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import org.apache.wicket.validation.IValidator;
|
|||||||
import org.apache.wicket.validation.ValidationError;
|
import org.apache.wicket.validation.ValidationError;
|
||||||
import org.apache.wicket.validation.validator.StringValidator;
|
import org.apache.wicket.validation.validator.StringValidator;
|
||||||
|
|
||||||
|
import com.commafeed.backend.dao.ApplicationSettingsService;
|
||||||
import com.commafeed.backend.dao.UserService;
|
import com.commafeed.backend.dao.UserService;
|
||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.commafeed.backend.model.UserRole.Role;
|
import com.commafeed.backend.model.UserRole.Role;
|
||||||
@@ -31,6 +32,9 @@ public class RegisterPanel extends Panel {
|
|||||||
@Inject
|
@Inject
|
||||||
UserService userService;
|
UserService userService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ApplicationSettingsService applicationSettingsService;
|
||||||
|
|
||||||
public RegisterPanel(String markupId) {
|
public RegisterPanel(String markupId) {
|
||||||
super(markupId);
|
super(markupId);
|
||||||
|
|
||||||
@@ -40,12 +44,14 @@ public class RegisterPanel extends Panel {
|
|||||||
"form", model) {
|
"form", model) {
|
||||||
@Override
|
@Override
|
||||||
protected void onSubmit() {
|
protected void onSubmit() {
|
||||||
RegistrationRequest req = getModelObject();
|
if (applicationSettingsService.get().isAllowRegistrations()) {
|
||||||
userService.register(req.getName(), req.getPassword(),
|
RegistrationRequest req = getModelObject();
|
||||||
Arrays.asList(Role.USER));
|
userService.register(req.getName(), req.getPassword(),
|
||||||
IAuthenticationStrategy strategy = getApplication()
|
Arrays.asList(Role.USER));
|
||||||
.getSecuritySettings().getAuthenticationStrategy();
|
IAuthenticationStrategy strategy = getApplication()
|
||||||
strategy.save(req.getName(), req.getPassword());
|
.getSecuritySettings().getAuthenticationStrategy();
|
||||||
|
strategy.save(req.getName(), req.getPassword());
|
||||||
|
}
|
||||||
setResponsePage(getApplication().getHomePage());
|
setResponsePage(getApplication().getHomePage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user