[[user-registration]]
= User Registration

:Notice: 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.



The Wicket viewer provides the ability for users to sign-up by providing a valid email address:

* from the login page the user can instead follow a link to take them to a sign-up page, where they enter their email address.
* a verification email is sent using this service; the email includes a link back to the running application.
* the user then completes the registration process by choosing a user name and password.
* the Wicket viewer then creates an account for them and logs them in.

In a similar way, if the user has forgotten their password then they can request a reset link to be sent to their email, again by providing their email address.

To support this the framework requires three services to be registered and configured:

* the xref:refguide:applib:index/services/userreg/UserRegistrationService.adoc[user registration service], which provides an API to create the user account
* the xref:refguide:applib:index/services/userreg/EmailNotificationService.adoc[email notification service], which provides an API for to send the verification emails
* the xref:refguide:applib:index/services/email/EmailService.adoc[email service], that is used by the email notification service to actually send the email.

The Apache Causeway core framework provides a default implementation of both the email notification service and the email service.
The xref:security:ROOT:about.adoc[Security Manager] extension provides a partial implementation of xref:refguide:applib:index/services/userreg/UserRegistrationService.adoc[user registration service] that you can complete for your own applications.




== Screenshots


The user is presented with a login page:

image::user-registration/login-page-default.png[width="300px"]


Navigate to the sign up page. Complete the page, and verify:

image::user-registration/sign-up-page.png[width="300px"]


Back to the login page:

image::user-registration/sign-up-login-page-after-sign-up.png[width="300px"]


Email arrives, with link:

image::user-registration/sign-up-email-with-verification-link.png[width="500px"]


Follow the link, complete the page:

image::user-registration/sign-up-registration-page.png[width="300px"]


Automatically logged in:

image::user-registration/sign-up-after-registration.png[width="800px"]




== Configuration

There are two prerequisites:

* register an implementation of the xref:refguide:applib:index/services/userreg/UserRegistrationService.adoc[user registration service]
+
The xref:security:ROOT:about.adoc[SecMan extension] provides an abstract subclass implementation that does most of the work.

* configure the xref:refguide:applib:index/services/email/EmailService.adoc[email service]
+
This is required by the default xref:refguide:applib:index/services/userreg/EmailNotificationService.adoc[email notification service].

It is also possible to configure the Wicket viewer to suppress the sign-up page link and/or the password reset page, see xref:vw:ROOT:setup-and-configuration.adoc#sign-in-sign-up-and-remember-me[here] for further details.




