You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/03 14:32:16 UTC
[25/87] [abbrv] [partial] isis git commit: ISIS-1194: moving the
wicket submodules to be direct children of core;
removing the isis-viewer-wicket parent pom.
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistry.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistry.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistry.java
new file mode 100644
index 0000000..7b030e0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistry.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages;
+
+import java.io.Serializable;
+
+import org.apache.wicket.Page;
+
+import org.apache.isis.viewer.wicket.model.models.PageType;
+
+/**
+ * Registry of the {@link Page} class to use for each {@link PageType}.
+ */
+public interface PageClassRegistry extends Serializable {
+
+ /**
+ * Used by <tt>WicketObjectsApplication</tt> to lookup pages from the
+ * registry.
+ */
+ public Class<? extends Page> getPageClass(PageType pageType);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistryAccessor.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistryAccessor.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistryAccessor.java
new file mode 100644
index 0000000..4ab9b57
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistryAccessor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages;
+
+import java.io.Serializable;
+
+/**
+ * API to obtain the {@link PageClassRegistry}.
+ */
+public interface PageClassRegistryAccessor extends Serializable {
+
+ PageClassRegistry getPageClassRegistry();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistrySpi.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistrySpi.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistrySpi.java
new file mode 100644
index 0000000..6113222
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageClassRegistrySpi.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages;
+
+import org.apache.wicket.Page;
+
+import org.apache.isis.viewer.wicket.model.models.PageType;
+
+/**
+ * Used by {@link PageClassList} implementations to add pages into the registry.
+ */
+public interface PageClassRegistrySpi {
+
+ public void registerPage(PageType pageType, Class<? extends Page> pageClass);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageNavigationService.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageNavigationService.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageNavigationService.java
new file mode 100644
index 0000000..194509b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageNavigationService.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages;
+
+import java.io.Serializable;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.isis.viewer.wicket.model.models.PageType;
+
+/**
+ * A service helping with the navigation to pages by type
+ */
+public interface PageNavigationService extends Serializable {
+
+ /**
+ * Schedules a page with a given {@link org.apache.isis.viewer.wicket.model.models.PageType type}
+ * to provide the response
+ *
+ * @param pageType The type of the page that should provide the response
+ */
+ void navigateTo(PageType pageType);
+
+ /**
+ * Schedules a page with a given {@link org.apache.isis.viewer.wicket.model.models.PageType type}
+ * and {@link org.apache.wicket.request.mapper.parameter.PageParameters parameters} to provide the response
+ *
+ * @param pageType The type of the page that should provide the response
+ * @param parameters The page parameters for the page that should provide the response
+ */
+ void navigateTo(PageType pageType, PageParameters parameters);
+
+ /**
+ * Restarts the current request cycle and schedules another page to provide the response
+ *
+ * @param pageType The type of the page that should provide the response
+ */
+ void restartAt(PageType pageType);
+
+ /**
+ * Restarts the current request cycle and schedules another page to provide the response.
+ * Information about the current page url and request parameters is preserved so that
+ * the application can return later by using {@link org.apache.wicket.Component#continueToOriginalDestination()}
+ *
+ * @param pageType The type of the page that should provide the response
+ */
+ void interceptAndRestartAt(PageType pageType);
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.css
new file mode 100644
index 0000000..eaeea17
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.css
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
new file mode 100644
index 0000000..eb3a892
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <wicket:head>
+ <wicket:link>
+ <link href="AboutPage.css" rel="stylesheet" type="text/css"/>
+ </wicket:link>
+ </wicket:head>
+ <body>
+ <wicket:extend>
+ <div class="aboutPage">
+ <div>
+ <div wicket:id="bookmarks"></div>
+ <div class="row">
+ <div class="col-xs-offset-2 col-xs-8">
+ <div wicket:id="about"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </wicket:extend>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.java
new file mode 100644
index 0000000..23a4290
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages.about;
+
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.pages.PageAbstract;
+
+/**
+ * Web page representing the about page.
+ */
+public class AboutPage extends PageAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public AboutPage(final PageParameters parameters) {
+ super(parameters, null, ComponentType.ABOUT);
+ addBookmarkedPages(themeDiv);
+ addChildComponents(themeDiv, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountConfirmationMap.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountConfirmationMap.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountConfirmationMap.java
new file mode 100644
index 0000000..fa7c1b1
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountConfirmationMap.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.pages.accmngt;
+
+import java.util.Map;
+
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.util.collections.MostRecentlyUsedMap;
+import org.apache.wicket.util.time.Duration;
+import org.apache.wicket.util.time.Time;
+
+/**
+ * A map that contains the emails to be verified. It has a constraint on the maximum entries that it
+ * can contain, and a constraint on the duration of time an entry is considered valid/non-expired
+ */
+public class AccountConfirmationMap extends MostRecentlyUsedMap<String, Object>
+{
+ private static final long serialVersionUID = 1L;
+
+ public static final MetaDataKey<AccountConfirmationMap> KEY = new MetaDataKey<AccountConfirmationMap>() {
+ };
+
+ /**
+ * The actual object that is stored as a value of the map. It wraps the email and
+ * assigns it a creation time.
+ */
+ private static class Value
+ {
+ /** the original email to store */
+ private String email;
+
+ /** the time when this email is stored */
+ private Time creationTime;
+ }
+
+ /**
+ * The duration of time before a {@link Value} is considered as expired
+ */
+ private final Duration lifetime;
+
+ /**
+ * Construct.
+ *
+ * @param maxEntries
+ * how much entries this map can contain
+ * @param lifetime
+ * the duration of time to keep an entry in the map before considering it expired
+ */
+ public AccountConfirmationMap(int maxEntries, Duration lifetime)
+ {
+ super(maxEntries);
+
+ this.lifetime = lifetime;
+ }
+
+ @Override
+ protected synchronized boolean removeEldestEntry(java.util.Map.Entry<String, Object> eldest)
+ {
+ boolean removed = super.removeEldestEntry(eldest);
+ if (removed == false)
+ {
+ Value value = (Value)eldest.getValue();
+ if (value != null)
+ {
+ Duration elapsedTime = Time.now().subtract(value.creationTime);
+ if (lifetime.lessThanOrEqual(elapsedTime))
+ {
+ removedValue = value.email;
+ removed = true;
+ }
+ }
+ }
+ return removed;
+ }
+
+ @Override
+ public String put(String key, Object email)
+ {
+ if (!(email instanceof String))
+ {
+ throw new IllegalArgumentException(AccountConfirmationMap.class.getSimpleName() +
+ " can store only instances of " + String.class.getSimpleName() + ": " + email);
+ }
+
+ Value value = new Value();
+ value.creationTime = Time.now();
+ value.email = (String)email;
+
+ Value oldValue;
+ synchronized (this)
+ {
+ oldValue = (Value)super.put(key, value);
+ }
+
+ return oldValue != null ? oldValue.email : null;
+ }
+
+ @Override
+ public String get(Object key)
+ {
+ String result = null;
+ Value value;
+ synchronized (this)
+ {
+ value = (Value)super.get(key);
+ }
+ if (value != null)
+ {
+ Duration elapsedTime = Time.now().subtract(value.creationTime);
+ if (lifetime.greaterThan(elapsedTime))
+ {
+ result = value.email;
+ }
+ else
+ {
+ // expired, remove it
+ remove(key);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public String remove(Object key)
+ {
+ Value removedValue;
+ synchronized (this)
+ {
+ removedValue = (Value)super.remove(key);
+ }
+
+ return removedValue != null ? removedValue.email : null;
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ?> m)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.html
new file mode 100644
index 0000000..b8957c0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.html
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org"
+ xml:lang="en"
+ lang="en">
+ <head>
+ <wicket:header-items/>
+ <title wicket:id="pageTitle"></title>
+ </head>
+ <body>
+ <div class="accountManagementPanel container-fluid">
+ <div class="jumbotron" style="background-color: transparent">
+
+ <div class="row">
+ <div class="col-sm-12"> </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-12"> </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-12"> </div>
+ </div>
+
+ <div class="row">
+ <div class="headerContainer col-sm-offset-4 col-sm-4">
+ <a wicket:id="signInLink">
+ <h1 wicket:id="applicationName" class="applicationName">[application name]</h1>
+ <img wicket:id="brandLogo"/>
+ </a>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="col-sm-12"> </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-12"> </div>
+ </div>
+
+ <wicket:child/>
+
+ </div>
+ <div wicket:id="exceptionStackTrace" class="exceptionStackTrace"></div>
+ </div>
+ <div class="javascriptInFooter">
+ <wicket:container wicket:id="footerJS"/>
+ </div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
new file mode 100644
index 0000000..cb6ac31
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages.accmngt;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapJavascriptBehavior;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.wicket.Application;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.head.CssReferenceHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem;
+import org.apache.wicket.markup.head.PriorityHeaderItem;
+import org.apache.wicket.markup.head.filter.HeaderResponseContainer;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.PageType;
+import org.apache.isis.viewer.wicket.ui.components.widgets.navbar.BrandLogo;
+import org.apache.isis.viewer.wicket.ui.components.widgets.navbar.BrandName;
+import org.apache.isis.viewer.wicket.ui.components.widgets.navbar.Placement;
+import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel;
+import org.apache.isis.viewer.wicket.ui.errors.ExceptionStackTracePanel;
+import org.apache.isis.viewer.wicket.ui.pages.PageAbstract;
+import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
+
+/**
+ * Boilerplate, pick up our HTML and CSS.
+ */
+public class AccountManagementPageAbstract extends WebPage {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_PAGE_TITLE = "pageTitle";
+ private static final String ID_APPLICATION_NAME = "applicationName";
+
+ private static final String ID_EXCEPTION_STACK_TRACE = "exceptionStackTrace";
+
+ /**
+ * The name of a special cookie that is used as a temporary container for
+ * stateless session scoped success feedback messages.
+ */
+ public static final String FEEDBACK_COOKIE_NAME = "isis.feedback.success";
+
+ /**
+ * {@link com.google.inject.Inject}ed when {@link #init() initialized}.
+ */
+ @Inject
+ @Named("applicationName")
+ private String applicationName;
+
+ /**
+ * {@link com.google.inject.Inject}ed when {@link #init() initialized}.
+ */
+ @Inject
+ @Named("applicationCss")
+ private String applicationCss;
+
+ /**
+ * {@link com.google.inject.Inject}ed when {@link #init() initialized}.
+ */
+ @Inject
+ @Named("applicationJs")
+ private String applicationJs;
+
+ /**
+ * If set by {@link org.apache.isis.viewer.wicket.ui.pages.PageAbstract}.
+ */
+ protected static ExceptionModel getAndClearExceptionModelIfAny() {
+ ExceptionModel exceptionModel = PageAbstract.EXCEPTION.get();
+ PageAbstract.EXCEPTION.remove();
+ return exceptionModel;
+ }
+
+ protected AccountManagementPageAbstract(final PageParameters parameters, final ExceptionModel exceptionModel) {
+ super(parameters);
+
+ Class<? extends Page> pageClass = pageClassRegistry.getPageClass(PageType.SIGN_IN);
+ BookmarkablePageLink<Void> signInLink = new BookmarkablePageLink<>("signInLink", pageClass);
+ signInLink.setAutoEnable(true);
+ add(signInLink);
+
+ addPageTitle();
+ addApplicationName(signInLink);
+
+ if(exceptionModel != null) {
+ add(new ExceptionStackTracePanel(ID_EXCEPTION_STACK_TRACE, exceptionModel));
+ } else {
+ add(new WebMarkupContainer(ID_EXCEPTION_STACK_TRACE).setVisible(false));
+ }
+
+ add(new HeaderResponseContainer("footerJS", "footerJS"));
+ BootstrapJavascriptBehavior.addTo(this);
+ }
+
+
+ private MarkupContainer addPageTitle() {
+ return add(new Label(ID_PAGE_TITLE, applicationName));
+ }
+
+ private void addApplicationName(MarkupContainer parent) {
+ final Placement placement = Placement.SIGNIN;
+ final BrandLogo brandLogo = new BrandLogo("brandLogo", placement);
+ final BrandName brandName = new BrandName(ID_APPLICATION_NAME, placement);
+ parent.add(brandName, brandLogo);
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())));
+
+ if(applicationCss != null) {
+ response.render(CssReferenceHeaderItem.forUrl(applicationCss));
+ }
+ if(applicationJs != null) {
+ response.render(JavaScriptReferenceHeaderItem.forUrl(applicationJs));
+ }
+ }
+
+
+
+ // ///////////////////////////////////////////////////
+ // System components
+ // ///////////////////////////////////////////////////
+
+ protected IsisConfiguration getConfiguration() {
+ return IsisContext.getConfiguration();
+ }
+
+ @javax.inject.Inject
+ private PageClassRegistry pageClassRegistry;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.properties
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.properties b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.properties
new file mode 100644
index 0000000..286e1ba
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.properties
@@ -0,0 +1,52 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+signUpHeader=Sign Up
+emailLabel=Email
+emailPlaceholder=Enter an email for the new account
+signUpPasswordLabel=Password
+passwordPlaceholder=Enter password
+emailIsNotAvailable=The given email is already in use
+signUpButtonLabel=Verify email
+emailSentMessage=An email has been sent to '${email}' for verification.
+
+passwordResetHeader=Forgot password
+emailPlaceholder=Enter your email
+passwordLabel=Password
+passwordPlaceholder=Enter your new password
+confirmPasswordLabel=Confirm password
+confirmPasswordPlaceholder=Type the same password again
+passwordResetSubmitLabel=Submit
+noSuchUserByEmail=There is no account with this email
+passwordChangeSuccessful=The password has been changed successfully. You can <a class="alert-success" style="text-decoration:underline;" href="${signInUrl}">login</a> now.
+passwordChangeUnsuccessful=There was a problem while updating the password. Please try again.
+passwordResetExpiredOrInvalidToken=You are trying to reset the password for an expired or invalid token
+noUserForAnEmailValidToken=The account seems to be either already deleted or has changed its email address. Please try again.
+
+registerHeader=Register
+usernameLabel=Username
+usernamePlaceholder=Username
+emailLabel=Email
+emailPlaceholder=Enter email
+passwordPlaceholder=Enter password
+confirmPasswordLabel=Confirm password
+confirmPasswordPlaceholder=Confirm password
+registerButtonLabel=Register
+resetButtonLabel=Reset
+usernameIsNotAvailable=The provided username is already in use
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailAvailableValidator.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailAvailableValidator.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailAvailableValidator.java
new file mode 100644
index 0000000..f1e51e3
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailAvailableValidator.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.pages.accmngt;
+
+import org.apache.wicket.validation.IValidatable;
+import org.apache.wicket.validation.IValidator;
+import org.apache.wicket.validation.ValidationError;
+import org.apache.isis.applib.services.userreg.UserRegistrationService;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+
+/**
+ * Validates that an email is or is not already in use by another user
+ */
+public class EmailAvailableValidator implements IValidator<String> {
+
+ public static final EmailAvailableValidator EXISTS = new EmailAvailableValidator(true, "noSuchUserByEmail");
+ public static final EmailAvailableValidator DOESNT_EXIST = new EmailAvailableValidator(false, "emailIsNotAvailable");
+
+ private final boolean emailExists;
+ private final String resourceKey;
+
+ private EmailAvailableValidator(boolean emailExists, String resourceKey) {
+ this.emailExists = emailExists;
+ this.resourceKey = resourceKey;
+ }
+
+ @Override
+ public void validate(final IValidatable<String> validatable) {
+ IsisContext.doInSession(new Runnable() {
+ @Override
+ public void run() {
+ UserRegistrationService userRegistrationService = IsisContext.getPersistenceSession().getServicesInjector().lookupService(UserRegistrationService.class);
+ String email = validatable.getValue();
+ boolean emailExists1 = userRegistrationService.emailExists(email);
+ if (emailExists1 != emailExists) {
+ validatable.error(new ValidationError().addKey(resourceKey));
+ }
+ }
+ });
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailVerificationUrlServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailVerificationUrlServiceDefault.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailVerificationUrlServiceDefault.java
new file mode 100644
index 0000000..2b1f474
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/EmailVerificationUrlServiceDefault.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.pages.accmngt;
+
+import java.util.UUID;
+import javax.inject.Inject;
+import org.apache.wicket.Application;
+import org.apache.wicket.Page;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.UrlRenderer;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.isis.viewer.wicket.model.models.PageType;
+import org.apache.isis.viewer.wicket.ui.pages.EmailVerificationUrlService;
+import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
+
+/**
+ * An implementation of {@link org.apache.isis.viewer.wicket.ui.pages.EmailVerificationUrlService}
+ * that uses Wicket's the current {@link org.apache.wicket.request.cycle.RequestCycle} to create the link and
+ * the special {@link org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountConfirmationMap}
+ * stored in the {@link org.apache.wicket.Application application} as a temporary storage of
+ * the non-encrypted data.
+ */
+public class EmailVerificationUrlServiceDefault implements EmailVerificationUrlService {
+
+ private final PageClassRegistry pageClassRegistry;
+
+ @Inject
+ public EmailVerificationUrlServiceDefault(PageClassRegistry pageClassRegistry) {
+ this.pageClassRegistry = pageClassRegistry;
+ }
+
+ /**
+ * Creates a url to the configured page for the given <em>pageType</em> by encrypting the given
+ * <em>datum</em> as a first indexed parameter
+ *
+ * @param pageType The type of the page to link to
+ * @param datum The data to encrypt in the url
+ * @return The full url to the page with the encrypted data
+ */
+ @Override
+ public String createVerificationUrl(final PageType pageType, final String datum) {
+ final Class<? extends Page> pageClass = pageClassRegistry.getPageClass(pageType);
+ return createVerificationUrl(pageClass, datum);
+ }
+
+ /**
+ * Creates a url to the passed <em>pageClass</em> by encrypting the given
+ * <em>datum</em> as a first indexed parameter
+ *
+ * @param pageClass The class of the page to link to
+ * @param datum The data to encrypt in the url
+ * @return The full url to the page with the encrypted data
+ */
+ @Override
+ public String createVerificationUrl(final Class<? extends Page> pageClass, final String datum) {
+ String uuid = UUID.randomUUID().toString();
+ uuid = uuid.replace("-", "");
+
+ final AccountConfirmationMap accountConfirmationMap = getAccountConfirmationMap();
+ accountConfirmationMap.put(uuid, datum);
+
+ final PageParameters parameters = new PageParameters();
+ parameters.set(0, uuid);
+
+ final String fullUrl = fullUrlFor(pageClass, parameters);
+ return fullUrl;
+ }
+
+ protected String fullUrlFor(final Class<? extends Page> pageClass, final PageParameters parameters) {
+ final RequestCycle requestCycle = RequestCycle.get();
+ final CharSequence relativeUrl = requestCycle.urlFor(pageClass, parameters);
+ final UrlRenderer urlRenderer = requestCycle.getUrlRenderer();
+ final String fullUrl = urlRenderer.renderFullUrl(Url.parse(relativeUrl));
+ return fullUrl;
+ }
+
+ protected AccountConfirmationMap getAccountConfirmationMap() {
+ return Application.get().getMetaData(AccountConfirmationMap.KEY);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/UsernameAvailableValidator.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/UsernameAvailableValidator.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/UsernameAvailableValidator.java
new file mode 100644
index 0000000..35c1312
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/UsernameAvailableValidator.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.pages.accmngt;
+
+import org.apache.wicket.validation.IValidatable;
+import org.apache.wicket.validation.IValidator;
+import org.apache.wicket.validation.ValidationError;
+import org.apache.isis.applib.services.userreg.UserRegistrationService;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+
+/**
+ * Validates that an username is or is not already in use by someone else
+ */
+public class UsernameAvailableValidator implements IValidator<String> {
+
+ public static final UsernameAvailableValidator INSTANCE = new UsernameAvailableValidator();
+
+ private UsernameAvailableValidator() {
+ }
+
+ @Override
+ public void validate(final IValidatable<String> validatable) {
+ IsisContext.doInSession(new Runnable() {
+ @Override
+ public void run() {
+ UserRegistrationService userRegistrationService = IsisContext.getPersistenceSession().getServicesInjector().lookupService(UserRegistrationService.class);
+ String username = validatable.getValue();
+ boolean usernameExists = userRegistrationService.usernameExists(username);
+ if (usernameExists) {
+ validatable.error(new ValidationError().addKey("usernameIsNotAvailable"));
+ }
+ }
+ });
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.html
new file mode 100644
index 0000000..ca8af7d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.html
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <form wicket:id="signUpForm" role="form">
+ <div class="form-group" wicket:id="formGroup">
+ <label wicket:for="email" class="control-label"><wicket:message key="emailLabel"/></label>
+ <input type="text" class="form-control" wicket:id="email" wicket:message="placeholder:emailPlaceholder"/>
+ </div>
+
+ <button type="submit" wicket:id="passwordResetSubmit" class="btn btn-primary"><wicket:message key="passwordResetSubmitLabel"/></button>
+ </form>
+
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.java
new file mode 100644
index 0000000..39f0d70
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetEmailPanel.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages.accmngt.password_reset;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.services.email.EmailService;
+import org.apache.isis.applib.services.userreg.EmailNotificationService;
+import org.apache.isis.applib.services.userreg.events.PasswordResetEvent;
+import org.apache.isis.viewer.wicket.model.models.PageType;
+import org.apache.isis.viewer.wicket.ui.components.widgets.bootstrap.FormGroup;
+import org.apache.isis.viewer.wicket.ui.pages.EmailVerificationUrlService;
+import org.apache.isis.viewer.wicket.ui.pages.PageNavigationService;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstract;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.EmailAvailableValidator;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.RequiredTextField;
+import org.apache.wicket.markup.html.form.StatelessForm;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.util.cookies.CookieUtils;
+import org.apache.wicket.validation.validator.EmailAddressValidator;
+
+import com.google.inject.name.Named;
+
+/**
+ * A panel with a form for creation of new users
+ */
+public class PasswordResetEmailPanel extends Panel {
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * the component id
+ */
+ public PasswordResetEmailPanel(final String id) {
+ super(id);
+
+ StatelessForm<Void> form = new StatelessForm<>("signUpForm");
+ addOrReplace(form);
+
+ final RequiredTextField<String> emailField = new RequiredTextField<>("email", Model.of(""));
+ emailField.setLabel(new ResourceModel("emailLabel"));
+ emailField.add(EmailAddressValidator.getInstance());
+ emailField.add(EmailAvailableValidator.EXISTS);
+
+ FormGroup formGroup = new FormGroup("formGroup", emailField);
+ form.add(formGroup);
+
+ formGroup.add(emailField);
+
+ Button signUpButton = new Button("passwordResetSubmit") {
+ @Override
+ public void onSubmit() {
+ super.onSubmit();
+
+ String email = emailField.getModelObject();
+
+ String confirmationUrl = emailVerificationUrlService.createVerificationUrl(PageType.PASSWORD_RESET, email);
+
+ /**
+ * We have to init() the services here because the Isis runtime is not available to us
+ * (guice will have instantiated a new instance of the service).
+ *
+ * We do it this way just so that the programming model for the EmailService is similar to regular Isis-managed services.
+ */
+ emailNotificationService.init();
+ emailService.init();
+
+ final PasswordResetEvent passwordResetEvent = new PasswordResetEvent(email, confirmationUrl, applicationName);
+ boolean emailSent = emailNotificationService.send(passwordResetEvent);
+ if (emailSent) {
+ Map<String, String> map = new HashMap<>();
+ map.put("email", email);
+ IModel<Map<String, String>> model = Model.ofMap(map);
+ String emailSentMessage = getString("emailSentMessage", model);
+
+ CookieUtils cookieUtils = new CookieUtils();
+ cookieUtils.save(AccountManagementPageAbstract.FEEDBACK_COOKIE_NAME, emailSentMessage);
+ pageNavigationService.navigateTo(PageType.SIGN_IN);
+ }
+ }
+ };
+
+ form.add(signUpButton);
+ }
+
+ @Inject
+ private EmailNotificationService emailNotificationService;
+ @Inject
+ private EmailService emailService;
+
+ @Inject
+ private EmailVerificationUrlService emailVerificationUrlService;
+
+ @Inject
+ private PageNavigationService pageNavigationService;
+
+ @Inject
+ @Named("applicationName")
+ private String applicationName;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.css
new file mode 100644
index 0000000..3727ba1
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.css
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+#header .applicationName {
+ display:none;
+}
+
+ .loginPanel {
+ width:310px;
+ background-color:#FFFFFF;
+ padding:20px;
+ border-radius:4px;
+ -moz-border-radius:4px;
+ -webkit-border-radius:4px;
+ margin-bottom:1%;
+ position:absolute;
+ clear:both;
+ height:200px;
+ left:50%;
+ top:50%;
+ margin-left:-175px;
+ margin-top:-100px;
+ }
+
+ .loginPanel h2 {
+ color:#423D37;
+ font-size:1.6em;
+ letter-spacing:0px;
+ line-height:150%;
+ margin-bottom:10px;
+ }
+
+ .loginPanel table {
+ width:100%;
+}
+
+.loginPanel table tr td {
+ padding:5px 0px;
+ text-align:left !important;
+}
+
+.loginPanel form input[type=text],
+.loginPanel form input[type=password] {
+ border-radius:4px;
+ -moz-borer-radius:4px;
+ -webkit-border-radius:4px;
+ padding:6px;
+ background-color:#F0EFEA;
+ border:1px solid #F0EFEA;
+ border-top:1px solid #CCCBC7;
+}
+
+
+.loginPanel form input[type=submit] {
+ background-color: #20B5C2;
+ border: 0 none;
+ border-radius: 4px 4px 4px 4px;
+ color: #FFFFFF;
+ cursor: pointer;
+ display: inline-block;
+ font-size: 0.9em;
+ padding: 5px 10px;
+}
+
+.loginPanel form input[type=reset] {
+ background-color: #E4E4DB;
+ border: 0 none;
+ border-radius: 4px 4px 4px 4px;
+ color: #46423C;
+ cursor: pointer;
+ display: inline-block;
+ font-size: 0.9em;
+ padding: 5px 10px;
+ text-transform: uppercase;
+}
+
+.loginPanel table tr td {
+ color:#46423C;
+}
+
+.wicketSignInPanel .mainMessage {
+ margin-top: 550px;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.html
new file mode 100644
index 0000000..37a0a27
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.html
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:extend>
+ <div class="row">
+ <div class="passwordResetPanel col-sm-offset-4 col-sm-4">
+ <div wicket:id="feedback"></div>
+
+ <h2><wicket:message key="passwordResetHeader"/></h2>
+ <div wicket:id="passwordResetPanel"></div>
+ </div>
+ </div>
+ </wicket:extend>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java
new file mode 100644
index 0000000..ff5b913
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPage.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages.accmngt.password_reset;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
+
+import java.util.concurrent.Callable;
+import org.apache.wicket.RestartResponseAtInterceptPageException;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.util.string.StringValue;
+import org.apache.wicket.util.string.Strings;
+import org.apache.isis.applib.services.userreg.UserRegistrationService;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountConfirmationMap;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstract;
+import org.apache.isis.viewer.wicket.ui.pages.login.WicketSignInPage;
+
+/**
+ * A page used for resetting the password of an user.
+ */
+public class PasswordResetPage extends AccountManagementPageAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_CONTENT_PANEL = "passwordResetPanel";
+
+ public PasswordResetPage(final PageParameters parameters) {
+ this(parameters, getAndClearExceptionModelIfAny());
+ }
+
+ private PasswordResetPage(final PageParameters parameters, ExceptionModel exceptionModel) {
+ super(parameters, exceptionModel);
+
+ boolean suppressPasswordResetLink = getConfiguration().getBoolean(WicketSignInPage.ISIS_VIEWER_WICKET_SUPPRESS_PASSWORD_RESET, false);
+ if(suppressPasswordResetLink) {
+ throw new RestartResponseAtInterceptPageException(WicketSignInPage.class);
+ }
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(new NotificationPanel("feedback"));
+
+ StringValue uuidValue = getPageParameters().get(0);
+ if (uuidValue.isEmpty()) {
+ addPasswordResetEmailPanel(ID_CONTENT_PANEL);
+ } else {
+ String uuid = uuidValue.toString();
+
+ AccountConfirmationMap accountConfirmationMap = getApplication().getMetaData(AccountConfirmationMap.KEY);
+ final String email = accountConfirmationMap.get(uuid);
+ if (Strings.isEmpty(email)) {
+ error(getString("passwordResetExpiredOrInvalidToken"));
+ addOrReplace(addPasswordResetEmailPanel(ID_CONTENT_PANEL));
+ } else {
+ Boolean emailExists = IsisContext.doInSession(new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ UserRegistrationService userRegistrationService = IsisContext.getPersistenceSession().getServicesInjector().lookupService(UserRegistrationService.class);
+ return userRegistrationService.emailExists(email);
+ }
+ });
+ if (!emailExists) {
+ error(getString("noUserForAnEmailValidToken"));
+ addOrReplace(addPasswordResetEmailPanel(ID_CONTENT_PANEL));
+ } else {
+ addPasswordResetPanel(ID_CONTENT_PANEL, uuid);
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a panel with password reset form fields.
+ *
+ * @param id The component id
+ * @param uuid A unique id used to identify the email of the user whose password will be reset
+ * @return A panel with "password reset" form fields
+ */
+ protected PasswordResetPanel addPasswordResetPanel(String id, String uuid) {
+ final PasswordResetPanel passwordResetPanel = new PasswordResetPanel(id, uuid);
+ addOrReplace(passwordResetPanel);
+ return passwordResetPanel;
+ }
+
+ /**
+ * Shows a panel where where the user has to provide her email address.
+ * An email with unique url will be sent to this email address. Once clicked
+ * {@link #addPasswordResetPanel(String, String)} will be used to actually
+ * change the password
+ *
+ * @param id The component id
+ * @return A panel with "send email for password reset" functionality
+ */
+ protected PasswordResetEmailPanel addPasswordResetEmailPanel(String id) {
+ final PasswordResetEmailPanel passwordResetEmailPanel = new PasswordResetEmailPanel(id);
+ addOrReplace(passwordResetEmailPanel);
+ return passwordResetEmailPanel;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.html
new file mode 100644
index 0000000..8348019
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.html
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <form wicket:id="passwordResetForm" role="form">
+ <div class="form-group">
+ <label wicket:for="password" class="control-label"><wicket:message key="passwordLabel"/></label>
+ <input type="password" class="form-control" wicket:id="password" wicket:message="placeholder:passwordPlaceholder"/>
+ </div>
+
+ <div class="form-group">
+ <label wicket:for="confirmPassword" class="control-label"><wicket:message key="confirmPasswordLabel"/></label>
+ <input type="password" class="form-control" wicket:id="confirmPassword" wicket:message="placeholder:confirmPasswordPlaceholder"/>
+ </div>
+
+ <button type="submit" wicket:id="passwordResetSubmit" class="btn btn-primary"><wicket:message key="passwordResetSubmitLabel"/></button>
+ </form>
+
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.java
new file mode 100644
index 0000000..8001c1e
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/password_reset/PasswordResetPanel.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages.accmngt.password_reset;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.common.INotificationMessage;
+import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationMessage;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import javax.inject.Inject;
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.markup.html.form.StatelessForm;
+import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.isis.applib.services.userreg.UserRegistrationService;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.PageType;
+import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountConfirmationMap;
+
+/**
+ * A panel with a form for creation of new users
+ */
+public class PasswordResetPanel extends Panel {
+
+ /**
+ * Constructor
+ *
+ * @param id The component id
+ * @param uuid The unique id to find the user's email address
+ */
+ public PasswordResetPanel(final String id, final String uuid) {
+ super(id);
+
+ StatelessForm<Void> form = new StatelessForm<>("passwordResetForm");
+ addOrReplace(form);
+
+ final PasswordTextField passwordField = new PasswordTextField("password", Model.of(""));
+ passwordField.setLabel(new ResourceModel("passwordLabel"));
+ form.add(passwordField);
+
+ final PasswordTextField confirmPasswordField = new PasswordTextField("confirmPassword", Model.of(""));
+ confirmPasswordField.setLabel(new ResourceModel("confirmPasswordLabel"));
+ form.add(confirmPasswordField);
+
+ form.add(new EqualPasswordInputValidator(passwordField, confirmPasswordField));
+
+ Button signUpButton = new Button("passwordResetSubmit") {
+ @Override
+ public void onSubmit() {
+ super.onSubmit();
+
+ final String password = confirmPasswordField.getModelObject();
+
+ final AccountConfirmationMap accountConfirmationMap = getApplication().getMetaData(AccountConfirmationMap.KEY);
+
+ Boolean passwordUpdated = IsisContext.doInSession(new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ String email = accountConfirmationMap.get(uuid);
+
+ UserRegistrationService userRegistrationService = IsisContext.getPersistenceSession().getServicesInjector().lookupService(UserRegistrationService.class);
+ return userRegistrationService.updatePasswordByEmail(email, password);
+ }
+ });
+
+ if (passwordUpdated) {
+ accountConfirmationMap.remove(uuid);
+ success(createPasswordChangeSuccessfulMessage());
+ } else {
+ error(getString("passwordChangeUnsuccessful"));
+ }
+ }
+ };
+
+ form.add(signUpButton);
+ }
+
+ private INotificationMessage createPasswordChangeSuccessfulMessage() {
+ Class<? extends Page> signInPage = pageClassRegistry.getPageClass(PageType.SIGN_IN);
+ CharSequence signInUrl = urlFor(signInPage, null);
+ Map<String, CharSequence> map = new HashMap<>();
+ map.put("signInUrl", signInUrl);
+ String passwordChangeSuccessful = getString("passwordChangeSuccessful", Model.ofMap(map));
+ NotificationMessage message = new NotificationMessage(Model.of(passwordChangeSuccessful));
+ message.escapeModelStrings(false);
+ return message;
+ }
+
+ @Inject
+ private PageClassRegistry pageClassRegistry;
+
+}
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.css
new file mode 100644
index 0000000..eaeea17
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.css
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.html
new file mode 100644
index 0000000..745ca5b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.html
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:extend>
+ <div class="row">
+ <div class="registerPanel col-sm-offset-4 col-sm-4">
+ <div wicket:id="feedback"></div>
+
+ <h2><wicket:message key="registerHeader">Register</wicket:message></h2>
+ <div wicket:id="content"></div>
+ </div>
+ </div>
+ </wicket:extend>
+ </body>
+
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.java
new file mode 100644
index 0000000..781360a
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPage.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.pages.accmngt.register;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.services.userreg.UserDetails;
+import org.apache.isis.viewer.wicket.model.models.PageType;
+import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel;
+import org.apache.isis.viewer.wicket.ui.pages.PageNavigationService;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountConfirmationMap;
+import org.apache.isis.viewer.wicket.ui.pages.accmngt.AccountManagementPageAbstract;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.util.string.StringValue;
+import org.apache.wicket.util.string.Strings;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
+
+/**
+ * Web page representing the about page.
+ */
+public class RegisterPage extends AccountManagementPageAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public RegisterPage(final PageParameters parameters) {
+ this(parameters, getAndClearExceptionModelIfAny());
+ }
+
+ private RegisterPage(final PageParameters parameters, final ExceptionModel exceptionModel) {
+ super(parameters, exceptionModel);
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(new NotificationPanel("feedback"));
+
+ final StringValue uuidValue = getPageParameters().get(0);
+ if (uuidValue.isEmpty()) {
+ pageNavigationService.navigateTo(PageType.SIGN_IN);
+ } else {
+ String uuid = uuidValue.toString();
+
+ AccountConfirmationMap accountConfirmationMap = getApplication().getMetaData(AccountConfirmationMap.KEY);
+ final String email = accountConfirmationMap.get(uuid);
+ if (Strings.isEmpty(email)) {
+ pageNavigationService.navigateTo(PageType.SIGN_IN);
+ } else {
+ UserDetails userDetails = newUserDetails();
+ addOrReplace(new RegisterPanel("content", userDetails, uuidValue.toString()) {
+ @Override
+ protected MarkupContainer newExtraFieldsContainer(String id) {
+ return RegisterPage.this.newExtraFieldsContainer(id);
+ }
+ });
+ }
+ }
+ }
+
+ protected UserDetails newUserDetails() {
+ return new UserDetails();
+ }
+
+ protected MarkupContainer newExtraFieldsContainer(final String id) {
+ return new WebMarkupContainer(id);
+ }
+
+ @Inject
+ private PageNavigationService pageNavigationService;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPanel.html
new file mode 100644
index 0000000..1ff9366
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/accmngt/register/RegisterPanel.html
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <form wicket:id="registerForm" role="form">
+ <div class="form-group">
+ <label wicket:for="email"><wicket:message key="emailLabel"/></label>
+ <input type="text" class="form-control" wicket:id="email" readonly tabindex="-1"/>
+ </div>
+
+ <div class="form-group" wicket:id="usernameFormGroup">
+ <label wicket:for="username" class="control-label"><wicket:message key="usernameLabel"/></label>
+ <input type="text" class="form-control" wicket:id="username" wicket:message="placeholder:usernamePlaceholder"/>
+ </div>
+
+ <div class="form-group" wicket:id="passwordFormGroup">
+ <label wicket:for="password" class="control-label"><wicket:message key="passwordLabel"/></label>
+ <input type="password" class="form-control" wicket:id="password" wicket:message="placeholder:passwordPlaceholder"/>
+ </div>
+
+ <div class="form-group" wicket:id="confirmPasswordFormGroup">
+ <label wicket:for="confirmPassword" class="control-label"><wicket:message key="confirmPasswordLabel"/></label>
+ <input type="password" class="form-control" wicket:id="confirmPassword" wicket:message="placeholder:confirmPasswordPlaceholder"/>
+ </div>
+
+ <wicket:container wicket:id="extraFieldsContainer"/>
+
+ <button type="submit" class="btn btn-primary btn-sm"><wicket:message key="registerButtonLabel"/></button>
+ <button type="reset" class="btn btn-default btn-sm"><wicket:message key="resetButtonLabel"/></button>
+ </form>
+ </wicket:panel>
+ </body>
+</html>