String onSuccess() throws RemoteException { try { visitor.setConfig(service.getSOInterfaceConfiguration(visitor.getId())); if (!visitor.getConfig().isLicenseAvailable()) { form.recordError(messages.get("license-expired-text")); return null; } if (!service.login(visitor.getId(), visitor.getPassword())) { form.recordError(messages.get("login-failed-message")); return null; } logout(); if (visitor.getLocale() == null) { visitor.setLocale(new Locale(visitor.getConfig().getDefaultLanguage())); } persistentLocale.set(visitor.getLocale()); setUser(visitor); // FIXME: commented out beccause some pages(eg, newsalesorder) requires an use coming // from a specific page(eg, customer/search). // if (sourcePage != null) { // return sourcePage; // } // A complete solution would be to define the relationships between pages // in some way, and use that to figure out which page to redirect to. However, // it's out of the scope of current requirement... . return "customer/search"; } finally { visitor = null; } }
Object onActionFromLogout() throws RemoteException { persistentLocale.set( new Locale(service.getSOInterfaceConfiguration(visitor.getId()).getDefaultLanguage())); logout(); cmpResources.discardPersistentFieldChanges(); if (_request.getSession() != null) _request.getSession().invalidate(); return Login.class; }
void onActivate() throws RemoteException { String from = _request.getParameter("redirectedFrom"); if (from != null) sourcePage = from; User user = getUser(); if (user != null) { visitor = user; } else { visitor = new User(); } if (visitor.getConfig() == null) { visitor.setConfig(service.getSOInterfaceConfiguration(visitor.getId())); visitor.setLocale(new Locale(visitor.getConfig().getDefaultLanguage())); } persistentLocale.set(visitor.getLocale()); }