Fix login and register for saas

This commit is contained in:
Stian Thorgersen 2013-09-24 12:53:47 +01:00
parent ea8e7cd86c
commit 5786087d7b
3 changed files with 9 additions and 7 deletions

View file

@ -55,6 +55,7 @@ public class TemplateBean {
if (realm.isSaas()) { if (realm.isSaas()) {
themeConfig.put("logo", themeUrl + "/img/red-hat-logo.png"); themeConfig.put("logo", themeUrl + "/img/red-hat-logo.png");
themeConfig.put("background", themeUrl + "/img/login-screen-background.jpg"); themeConfig.put("background", themeUrl + "/img/login-screen-background.jpg");
themeConfig.put("displayPoweredBy", false);
} else { } else {
themeConfig.put("background", themeUrl + "/img/customer-login-screen-bg2.jpg"); themeConfig.put("background", themeUrl + "/img/customer-login-screen-bg2.jpg");
themeConfig.put("displayPoweredBy", true); themeConfig.put("displayPoweredBy", true);

View file

@ -240,7 +240,7 @@ public class AccountService {
UserModel user = realm.getUser(username); UserModel user = realm.getUser(username);
if (user == null || !email.equals(user.getEmail())) { if (user == null || !email.equals(user.getEmail())) {
Flows.forms(realm, request, uriInfo).setError("Invalid username or email") return Flows.forms(realm, request, uriInfo).setError("Invalid username or email")
.forwardToAction(RequiredAction.UPDATE_PASSWORD); .forwardToAction(RequiredAction.UPDATE_PASSWORD);
} }

View file

@ -19,6 +19,7 @@ import org.keycloak.services.validation.Validation;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.container.ResourceContext; import javax.ws.rs.container.ResourceContext;
import javax.ws.rs.core.*; import javax.ws.rs.core.*;
import java.net.URI; import java.net.URI;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -165,34 +166,34 @@ public class SaasService {
@Path("login") @Path("login")
@GET @GET
@NoCache @NoCache
public void loginPage() { public Response loginPage() {
RealmManager realmManager = new RealmManager(session); RealmManager realmManager = new RealmManager(session);
RealmModel realm = realmManager.defaultRealm(); RealmModel realm = realmManager.defaultRealm();
authManager.expireSaasIdentityCookie(uriInfo); authManager.expireSaasIdentityCookie(uriInfo);
Flows.forms(realm, request, uriInfo).forwardToLogin(); return Flows.forms(realm, request, uriInfo).forwardToLogin();
} }
@Path("registrations") @Path("registrations")
@GET @GET
@NoCache @NoCache
public void registerPage() { public Response registerPage() {
RealmManager realmManager = new RealmManager(session); RealmManager realmManager = new RealmManager(session);
RealmModel realm = realmManager.defaultRealm(); RealmModel realm = realmManager.defaultRealm();
authManager.expireSaasIdentityCookie(uriInfo); authManager.expireSaasIdentityCookie(uriInfo);
Flows.forms(realm, request, uriInfo).forwardToRegistration(); return Flows.forms(realm, request, uriInfo).forwardToRegistration();
} }
@Path("logout") @Path("logout")
@GET @GET
@NoCache @NoCache
public void logout() { public Response logout() {
RealmManager realmManager = new RealmManager(session); RealmManager realmManager = new RealmManager(session);
RealmModel realm = realmManager.defaultRealm(); RealmModel realm = realmManager.defaultRealm();
authManager.expireSaasIdentityCookie(uriInfo); authManager.expireSaasIdentityCookie(uriInfo);
Flows.forms(realm, request, uriInfo).forwardToLogin(); return Flows.forms(realm, request, uriInfo).forwardToLogin();
} }
@Path("logout-cookie") @Path("logout-cookie")