You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/11/04 12:54:29 UTC

[incubator-streampipes] 03/03: [STREAMPIPES-457] Add initial views for password recovery and self-registration

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch STREAMPIPES-426
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit a38ff88d6495c6a0a65e85a188b5229ccb876ee1
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Thu Nov 4 13:54:08 2021 +0100

    [STREAMPIPES-457] Add initial views for password recovery and self-registration
---
 .../backend/UnauthenticatedInterfaces.java         |  2 +
 .../apache/streampipes/commons/constants/Envs.java |  2 +-
 .../commons/constants/InstallationConstants.java   |  2 +-
 .../exceptions/UsernameAlreadyTakenException.java  | 18 +++--
 .../config/backend/model/GeneralConfig.java        | 31 ++++++++
 .../model/client/setup/InitialSettings.java        | 10 +--
 .../model/client/user/RegistrationData.java        |  7 --
 .../streampipes/model/client/user/UserAccount.java |  9 ---
 .../streampipes/model/client/user/UserInfo.java    |  9 ---
 .../model/message/NotificationType.java            |  3 +-
 .../manager/pipeline/PipelineManager.java          |  4 +-
 .../manager/recommender/ElementRecommender.java    | 10 ++-
 .../manager/setup/AutoInstallation.java            |  6 +-
 .../manager/setup/InstallationConfiguration.java   |  4 +-
 .../streampipes/manager/storage/UserService.java   | 73 ------------------
 .../manager/pipeline/TestPipelineManager.java      |  6 +-
 streampipes-resource-management/pom.xml            |  5 ++
 .../resource/management/SpResourceManager.java     |  4 +
 .../resource/management/UserResourceManager.java   | 32 +++++---
 .../rest/core/base/impl/AbstractRestResource.java  |  3 +-
 .../apache/streampipes/rest/ResetManagement.java   |  4 +-
 .../streampipes/rest/impl/Authentication.java      | 49 +++++++++---
 .../rest/impl/RestorePasswordResource.java         |  8 +-
 .../rest/impl/UserRegistrationResource.java        | 15 ++--
 .../impl/admin/EmailConfigurationResource.java     |  2 +-
 .../streampipes/storage/api/IUserStorage.java      |  2 -
 .../storage/couchdb/impl/UserStorage.java          |  9 ---
 .../user/management/jwt/JwtTokenProvider.java      |  1 -
 ui/deployment/app-routing.module.mst               | 11 ++-
 .../already-configured.can-activate.guard.ts       |  4 -
 ... => registration-allowed.can-activate.guard.ts} | 33 ++++----
 ...restore-password-allowed.can-activate.guard.ts} | 31 ++++----
 ui/src/app/app-routing.module.ts                   |  9 ++-
 .../email-configuration.component.html             | 15 +++-
 .../email-configuration.component.ts               | 15 +++-
 .../general-configuration.component.html           | 44 +++++++++--
 .../general-configuration.component.ts             | 34 +++++++--
 .../edit-user-dialog.component.html                | 11 +--
 .../edit-user-dialog/edit-user-dialog.component.ts |  2 -
 .../security-user-config.component.html            | 12 +--
 .../security-user-config.component.ts              |  2 +-
 ui/src/app/connect/services/rest.service.ts        |  2 +-
 .../app/core-model/gen/streampipes-model-client.ts |  6 +-
 .../core/components/iconbar/iconbar.component.ts   |  2 +-
 .../auth-box.component.html}                       | 31 +-------
 .../components/auth-box/auth-box.component.scss}   |  7 --
 .../components/auth-box/auth-box.component.ts}     | 23 ++++--
 .../login/components/login/login.component.html    | 45 ++++-------
 .../components/login/login.component.scss}         | 10 +--
 .../app/login/components/login/login.component.ts  | 37 +++++++--
 .../components/login/login.model.ts}               |  8 +-
 .../components/register/register.component.html    | 65 ++++++++++++++++
 .../components/register/register.component.scss}   | 18 +++--
 .../components/register/register.component.ts      | 89 ++++++++++++++++++++++
 .../components/register/registration.model.ts}     |  8 +-
 .../restore-password.component.html                | 42 ++++++++++
 .../restore-password.component.scss}               |  7 --
 .../restore-password/restore-password.component.ts | 54 +++++++++++++
 ui/src/app/login/login.module.ts                   |  6 ++
 ui/src/app/login/services/login.service.ts         | 19 ++++-
 .../app/notifications/notifications.component.ts   |  2 +-
 .../model/general-config.model.ts                  |  3 +
 .../general-profile-settings.component.html        |  6 +-
 63 files changed, 678 insertions(+), 365 deletions(-)

diff --git a/streampipes-backend/src/main/java/org/apache/streampipes/backend/UnauthenticatedInterfaces.java b/streampipes-backend/src/main/java/org/apache/streampipes/backend/UnauthenticatedInterfaces.java
index 3971e30..6b773b5 100644
--- a/streampipes-backend/src/main/java/org/apache/streampipes/backend/UnauthenticatedInterfaces.java
+++ b/streampipes-backend/src/main/java/org/apache/streampipes/backend/UnauthenticatedInterfaces.java
@@ -26,6 +26,8 @@ public class UnauthenticatedInterfaces {
     return Arrays.asList(
             "/api/v2/setup/configured",
             "/api/v2/auth/login",
+            "/api/v2/auth/register",
+            "/api/v2/auth/settings",
             "/api/v2/pe/*/assets/icon",
             "/api/v2/connect/master/description/*/assets/icon",
             "/api/v2/connect/*/master/administration/**",
diff --git a/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/Envs.java b/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/Envs.java
index e342506..6324bc9 100644
--- a/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/Envs.java
+++ b/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/Envs.java
@@ -24,7 +24,7 @@ public enum Envs {
   SP_CONSUL_LOCATION("CONSUL_LOCATION"),
   SP_KAFKA_RETENTION_MS("SP_KAFKA_RETENTION_MS"),
   SP_JWT_SECRET("JWT_SECRET"),
-  SP_INITIAL_ADMIN_USER("SP_INITIAL_ADMIN_USER"),
+  SP_INITIAL_ADMIN_EMAIL("SP_INITIAL_ADMIN_EMAIL"),
   SP_INITIAL_ADMIN_PASSWORD("SP_INITIAL_ADMIN_PASSWORD"),
   SP_INITIAL_CLIENT_USER("SP_INITIAL_SERVICE_USER"),
   SP_INITIAL_CLIENT_SECRET("SP_INITIAL_CLIENT_SECRET"),
diff --git a/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/InstallationConstants.java b/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/InstallationConstants.java
index 42effdc..4acb05c 100644
--- a/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/InstallationConstants.java
+++ b/streampipes-commons/src/main/java/org/apache/streampipes/commons/constants/InstallationConstants.java
@@ -19,7 +19,7 @@ package org.apache.streampipes.commons.constants;
 
 public class InstallationConstants {
 
-  public static final String INITIAL_ADMIN_USER_DEFAULT = "admin";
+  public static final String INITIAL_ADMIN_EMAIL_DEFAULT = "admin@streampipes.apache.org";
   public static final String INITIAL_ADMIN_PW_DEFAULT = "admin";
   public static final String INITIAL_CLIENT_USER_DEFAULT = "sp-service-client";
   public static final String INITIAL_CLIENT_SECRET_DEFAULT = "my-apache-streampipes-secret-key-change-me";
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/streampipes-commons/src/main/java/org/apache/streampipes/commons/exceptions/UsernameAlreadyTakenException.java
similarity index 67%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to streampipes-commons/src/main/java/org/apache/streampipes/commons/exceptions/UsernameAlreadyTakenException.java
index 5ace2ec..f2328e2 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/streampipes-commons/src/main/java/org/apache/streampipes/commons/exceptions/UsernameAlreadyTakenException.java
@@ -15,10 +15,18 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.commons.exceptions;
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+public class UsernameAlreadyTakenException extends SpException{
+  public UsernameAlreadyTakenException(String message) {
+    super(message);
+  }
+
+  public UsernameAlreadyTakenException(Throwable cause) {
+    super(cause);
+  }
+
+  public UsernameAlreadyTakenException(String message, Throwable cause) {
+    super(message, cause);
+  }
 }
diff --git a/streampipes-config/src/main/java/org/apache/streampipes/config/backend/model/GeneralConfig.java b/streampipes-config/src/main/java/org/apache/streampipes/config/backend/model/GeneralConfig.java
index 66a7c68..df6cbf2 100644
--- a/streampipes-config/src/main/java/org/apache/streampipes/config/backend/model/GeneralConfig.java
+++ b/streampipes-config/src/main/java/org/apache/streampipes/config/backend/model/GeneralConfig.java
@@ -17,6 +17,8 @@
  */
 package org.apache.streampipes.config.backend.model;
 
+import java.util.List;
+
 public class GeneralConfig {
 
   private String protocol;
@@ -24,6 +26,11 @@ public class GeneralConfig {
   private int port;
   private boolean configured;
 
+  private boolean allowSelfRegistration;
+  private boolean allowPasswordRecovery;
+
+  private List<String> defaultUserRoles;
+
   public GeneralConfig() {
   }
 
@@ -64,4 +71,28 @@ public class GeneralConfig {
   public void setConfigured(boolean configured) {
     this.configured = configured;
   }
+
+  public boolean isAllowSelfRegistration() {
+    return allowSelfRegistration;
+  }
+
+  public void setAllowSelfRegistration(boolean allowSelfRegistration) {
+    this.allowSelfRegistration = allowSelfRegistration;
+  }
+
+  public boolean isAllowPasswordRecovery() {
+    return allowPasswordRecovery;
+  }
+
+  public void setAllowPasswordRecovery(boolean allowPasswordRecovery) {
+    this.allowPasswordRecovery = allowPasswordRecovery;
+  }
+
+  public List<String> getDefaultUserRoles() {
+    return defaultUserRoles;
+  }
+
+  public void setDefaultUserRoles(List<String> defaultUserRoles) {
+    this.defaultUserRoles = defaultUserRoles;
+  }
 }
diff --git a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/setup/InitialSettings.java b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/setup/InitialSettings.java
index c79c09c..781ee12 100644
--- a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/setup/InitialSettings.java
+++ b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/setup/InitialSettings.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.model.client.setup;
 
 public class InitialSettings {
 
-	private String adminUser;
+	private String adminEmail;
 	private String adminPassword;
 	private String initialServiceAccountName;
 	private String initialServiceAccountSecret;
@@ -46,12 +46,12 @@ public class InitialSettings {
 		this.installPipelineElements = installPipelineElements;
 	}
 
-	public String getAdminUser() {
-		return adminUser;
+	public String getAdminEmail() {
+		return adminEmail;
 	}
 
-	public void setAdminUser(String adminUser) {
-		this.adminUser = adminUser;
+	public void setAdminEmail(String adminEmail) {
+		this.adminEmail = adminEmail;
 	}
 
 	public String getInitialServiceAccountName() {
diff --git a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/RegistrationData.java b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/RegistrationData.java
index 4ab744f..3b431d6 100644
--- a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/RegistrationData.java
+++ b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/RegistrationData.java
@@ -24,7 +24,6 @@ public class RegistrationData {
 
 	private String username;
 	private String password;
-	private String email;
 	private Role role;
 	
 	private List<String> roles;
@@ -46,12 +45,6 @@ public class RegistrationData {
 	public void setPassword(String password) {
 		this.password = password;
 	}
-	public String getEmail() {
-		return email;
-	}
-	public void setEmail(String email) {
-		this.email = email;
-	}
 
 	public List<String> getRoles() {
 		return roles;
diff --git a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserAccount.java b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserAccount.java
index 928ca7b..009e156 100644
--- a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserAccount.java
+++ b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserAccount.java
@@ -27,7 +27,6 @@ import java.util.Set;
 @TsModel
 public class UserAccount extends Principal {
 
-	protected String email;
 	protected String fullName;
 	protected String password;
 
@@ -62,14 +61,6 @@ public class UserAccount extends Principal {
 		this.preferredDataStreams = new ArrayList<>();
 	}
 
-	public String getEmail() {
-		return email;
-	}
-
-	public void setEmail(String email) {
-		this.email = email;
-	}
-
 	public void setPassword(String password) {
 		this.password = password;
 	}
diff --git a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserInfo.java b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserInfo.java
index dd12381..4295f84 100644
--- a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserInfo.java
+++ b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/user/UserInfo.java
@@ -27,7 +27,6 @@ public class UserInfo {
 
   private String username;
   private String displayName;
-  private String email;
   private Set<String> roles;
   private boolean showTutorial;
   private boolean darkMode;
@@ -51,14 +50,6 @@ public class UserInfo {
     this.displayName = displayName;
   }
 
-  public String getEmail() {
-    return email;
-  }
-
-  public void setEmail(String email) {
-    this.email = email;
-  }
-
   public Set<String> getRoles() {
     return roles;
   }
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/message/NotificationType.java b/streampipes-model/src/main/java/org/apache/streampipes/model/message/NotificationType.java
index e8720c4..b0a24bd 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/message/NotificationType.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/message/NotificationType.java
@@ -65,8 +65,9 @@ public enum NotificationType {
 	INSTALLATION_SUCCESSFUL("Installation successful", ""), 
 	
 	PROPERTY_FILE_WRITTEN("Writing properties file...", ""), 
-	ADMIN_USER_CREATED("Creating admin user...", "");
+	ADMIN_USER_CREATED("Creating admin user...", ""),
 
+	PASSWORD_RECOVERY_LINK_SENT("Check your mail inbox for instructions how to reset your password", "");
 
 	private final String title;
 	private final String description;
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
index 6a077a0..e67b975 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
@@ -21,7 +21,7 @@ package org.apache.streampipes.manager.pipeline;
 import org.apache.streampipes.commons.random.UUIDGenerator;
 import org.apache.streampipes.manager.operations.Operations;
 import org.apache.streampipes.manager.permission.PermissionManager;
-import org.apache.streampipes.manager.storage.UserManagementService;
+import org.apache.streampipes.manager.storage.UserService;
 import org.apache.streampipes.model.client.user.Permission;
 import org.apache.streampipes.model.pipeline.Pipeline;
 import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
@@ -40,7 +40,7 @@ public class PipelineManager {
      * @return all pipelines
      */
     public static List<Pipeline> getOwnPipelines(String username) {
-        return UserManagementService.getUserService().getOwnPipelines(username);
+        return new UserService(StorageDispatcher.INSTANCE.getNoSqlStore().getUserStorageAPI()).getOwnPipelines(username);
     }
 
     /**
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
index 60f2b34..e40f3b2 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
@@ -24,7 +24,7 @@ import org.apache.streampipes.manager.data.PipelineGraph;
 import org.apache.streampipes.manager.data.PipelineGraphBuilder;
 import org.apache.streampipes.manager.matching.InvocationGraphBuilder;
 import org.apache.streampipes.manager.matching.v2.StreamMatch;
-import org.apache.streampipes.manager.storage.UserManagementService;
+import org.apache.streampipes.manager.storage.UserService;
 import org.apache.streampipes.manager.util.PipelineVerificationUtils;
 import org.apache.streampipes.model.SpDataStream;
 import org.apache.streampipes.model.base.ConsumableStreamPipesEntity;
@@ -153,7 +153,7 @@ public class ElementRecommender {
   }
 
   private List<ConsumableStreamPipesEntity> getAllSepas() {
-    List<String> userObjects = UserManagementService.getUserService().getOwnSepaUris(email);
+    List<String> userObjects = getUserService().getOwnSepaUris(email);
     return getTripleStore()
             .getAllDataProcessors()
             .stream()
@@ -164,7 +164,7 @@ public class ElementRecommender {
 
 
   private List<ConsumableStreamPipesEntity> getAllSecs() {
-    List<String> userObjects = UserManagementService.getUserService().getOwnActionUris(email);
+    List<String> userObjects = getUserService().getOwnActionUris(email);
     return getTripleStore()
             .getAllDataSinks()
             .stream()
@@ -229,4 +229,8 @@ public class ElementRecommender {
       }
     }
   }
+
+  private UserService getUserService() {
+    return new UserService(StorageDispatcher.INSTANCE.getNoSqlStore().getUserStorageAPI());
+  }
 }
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/AutoInstallation.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/AutoInstallation.java
index a331027..984e3ad 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/AutoInstallation.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/AutoInstallation.java
@@ -54,7 +54,7 @@ public class AutoInstallation {
   private InitialSettings collectInitialSettings() {
     InitialSettings settings = new InitialSettings();
     settings.setInstallPipelineElements(autoInstallPipelineElements());
-    settings.setAdminUser(findAdminUser());
+    settings.setAdminEmail(findAdminUser());
     settings.setAdminPassword(findAdminPassword());
     settings.setInitialServiceAccountName(findServiceAccountName());
     settings.setInitialServiceAccountSecret(findServiceAccountSecret());
@@ -86,8 +86,8 @@ public class AutoInstallation {
 
   private String findAdminUser() {
     return getStringOrDefault(
-            Envs.SP_INITIAL_ADMIN_USER.getEnvVariableName(),
-            InstallationConstants.INITIAL_ADMIN_USER_DEFAULT
+            Envs.SP_INITIAL_ADMIN_EMAIL.getEnvVariableName(),
+            InstallationConstants.INITIAL_ADMIN_EMAIL_DEFAULT
     );
   }
 
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java
index 308d377..d39213f 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java
@@ -33,14 +33,14 @@ public class InstallationConfiguration {
 
 		steps.add(new CouchDbInstallationStep());
 		steps.add(new UserRegistrationInstallationStep(
-						settings.getAdminUser(),
+						settings.getAdminEmail(),
 						settings.getAdminPassword(),
 						settings.getInitialServiceAccountName(),
 						settings.getInitialServiceAccountSecret()));
 
 		if (settings.getInstallPipelineElements()) {
 			for(ExtensionsServiceEndpoint endpoint : new EndpointFetcher().getEndpoints()) {
-				steps.add(new PipelineElementInstallationStep(endpoint, settings.getAdminUser()));
+				steps.add(new PipelineElementInstallationStep(endpoint, settings.getAdminEmail()));
 			}
 		}
 		
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserService.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserService.java
index 5bb9a20..b303e83 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserService.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserService.java
@@ -18,7 +18,6 @@
 
 package org.apache.streampipes.manager.storage;
 
-import org.apache.streampipes.commons.exceptions.ElementNotFoundException;
 import org.apache.streampipes.model.client.user.Principal;
 import org.apache.streampipes.model.pipeline.Pipeline;
 import org.apache.streampipes.storage.api.INoSqlStorage;
@@ -44,69 +43,6 @@ public class UserService {
             .collect(Collectors.toList());
   }
 
-  public Pipeline getPipeline(String username, String pipelineId) throws ElementNotFoundException {
-    return StorageDispatcher
-            .INSTANCE
-            .getNoSqlStore()
-            .getPipelineStorageAPI()
-            .getAllPipelines()
-            .stream()
-            .filter(p -> p.getPipelineId().equals(pipelineId))
-            .findFirst()
-            .orElseThrow(ElementNotFoundException::new);
-  }
-
-  /**
-   * Own Elements
-   */
-
-  public void addOwnPipeline(String username, Pipeline pipeline) {
-
-    if (!checkUser(username)) {
-      return;
-    }
-//        User user = userStorage.getUser(username);
-//        user.addOwnPipeline(pipeline);
-//        userStorage.updateUser(user);
-    StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI().storePipeline(pipeline);
-  }
-
-  public void addOwnSource(String username, String elementId, boolean publicElement) {
-    if (!checkUser(username)) {
-      return;
-    }
-    Principal user = getPrincipal(username);
-    //user.addOwnSource(elementId, publicElement);
-    userStorage.updateUser(user);
-  }
-
-  public void addOwnAction(String username, String elementId, boolean publicElement) {
-    if (!checkUser(username)) {
-      return;
-    }
-    Principal user = getPrincipal(username);
-    //user.addOwnAction(elementId, publicElement);
-    userStorage.updateUser(user);
-  }
-
-  public void addOwnSepa(String username, String elementId, boolean publicElement) {
-    if (!checkUser(username)) {
-      return;
-    }
-    Principal user = getPrincipal(username);
-    //user.addOwnSepa(elementId, publicElement);
-    userStorage.updateUser(user);
-  }
-
-  public void deleteOwnAction(String username, String actionId) {
-    if (checkUser(username)) {
-      Principal user = getPrincipal(username);
-      //user.getOwnActions().removeIf(a -> a.getElementId().equals(actionId));
-      userStorage.updateUser(user);
-      //TODO remove actions from other users
-    }
-  }
-
   public void deleteOwnSource(String username, String sourceId) {
     if (checkUser(username)) {
       Principal user = getPrincipal(username);
@@ -115,15 +51,6 @@ public class UserService {
     }
   }
 
-  public void deleteOwnSepa(String username, String sepaId) {
-    if (checkUser(username)) {
-      Principal user = getPrincipal(username);
-      //user.getOwnSepas().removeIf(a -> a.getElementId().equals(sepaId));
-      userStorage.updateUser(user);
-    }
-  }
-
-
   /**
    * Get actions/sepas/sources
    */
diff --git a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java
index 88bc61b..e6904ae 100644
--- a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java
+++ b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java
@@ -18,7 +18,7 @@
 package org.apache.streampipes.manager.pipeline;
 
 import org.apache.streampipes.manager.operations.Operations;
-import org.apache.streampipes.manager.storage.UserManagementService;
+import org.apache.streampipes.resource.management.UserResourceManager;
 import org.apache.streampipes.model.pipeline.Pipeline;
 import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
 import org.apache.streampipes.test.generator.pipeline.DummyPipelineGenerator;
@@ -36,7 +36,7 @@ import static junit.framework.TestCase.assertNotNull;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({
-        UserManagementService.class,
+        UserResourceManager.class,
         PipelineManager.class,
         Operations.class})
 public class TestPipelineManager {
@@ -44,7 +44,7 @@ public class TestPipelineManager {
   @Before
   public void before() {
     PowerMockito.mockStatic(
-            UserManagementService.class);
+            UserResourceManager.class);
   }
 
   @Test
diff --git a/streampipes-resource-management/pom.xml b/streampipes-resource-management/pom.xml
index 0cb9b20..6112744 100644
--- a/streampipes-resource-management/pom.xml
+++ b/streampipes-resource-management/pom.xml
@@ -17,6 +17,11 @@
             <artifactId>streampipes-storage-management</artifactId>
             <version>0.69.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-user-management</artifactId>
+            <version>0.69.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
index 71a134c..3b362e3 100644
--- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
@@ -50,4 +50,8 @@ public class SpResourceManager {
   public PermissionResourceManager managePermissions() {
     return new PermissionResourceManager();
   }
+
+  public UserResourceManager manageUsers() {
+    return new UserResourceManager();
+  }
 }
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserManagementService.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/UserResourceManager.java
similarity index 65%
rename from streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserManagementService.java
rename to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/UserResourceManager.java
index 2ea3715..59a8a98 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/UserManagementService.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/UserResourceManager.java
@@ -16,8 +16,9 @@
  *
  */
 
-package org.apache.streampipes.manager.storage;
+package org.apache.streampipes.resource.management;
 
+import org.apache.streampipes.commons.exceptions.UsernameAlreadyTakenException;
 import org.apache.streampipes.model.client.user.RegistrationData;
 import org.apache.streampipes.model.client.user.Role;
 import org.apache.streampipes.model.client.user.UserAccount;
@@ -27,17 +28,28 @@ import org.apache.streampipes.user.management.util.PasswordUtil;
 
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
-import java.util.Set;
+import java.util.HashSet;
+import java.util.List;
+import java.util.stream.Collectors;
 
-public class UserManagementService {
+public class UserResourceManager extends AbstractResourceManager<IUserStorage> {
 
-  public Boolean registerUser(RegistrationData data, Set<Role> roles) {
+  public UserResourceManager() {
+    super(StorageDispatcher.INSTANCE.getNoSqlStore().getUserStorageAPI());
+  }
+
+  public boolean registerUser(RegistrationData data) throws UsernameAlreadyTakenException {
 
     try {
+      if (db.checkUser(data.getUsername())) {
+        throw new UsernameAlreadyTakenException("Username already taken");
+      }
       String encryptedPassword = PasswordUtil.encryptPassword(data.getPassword());
-      UserAccount user = UserAccount.from(data.getEmail(), encryptedPassword, roles);
+      List<Role> roles = data.getRoles().stream().map(Role::valueOf).collect(Collectors.toList());
+      UserAccount user = UserAccount.from(data.getUsername(), encryptedPassword, new HashSet<>(roles));
+      user.setUsername(data.getUsername());
       user.setPassword(encryptedPassword);
-      getUserStorage().storeUser(user);
+      db.storeUser(user);
     } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
       return false;
     }
@@ -52,12 +64,12 @@ public class UserManagementService {
     userService.updateUser(user);
   }
 
-  public static UserService getUserService() {
-    return new UserService(getUserStorage());
-  }
-
   public static IUserStorage getUserStorage() {
     return StorageDispatcher.INSTANCE.getNoSqlStore().getUserStorageAPI();
   }
 
+  public void sendPasswordRecoveryLink(String username) {
+    // send a password recovery link to the user
+
+  }
 }
diff --git a/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java
index 43fd507..ae86f91 100644
--- a/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java
+++ b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java
@@ -20,7 +20,6 @@ package org.apache.streampipes.rest.core.base.impl;
 
 import org.apache.http.client.ClientProtocolException;
 import org.apache.streampipes.manager.endpoint.HttpJsonParser;
-import org.apache.streampipes.manager.storage.UserManagementService;
 import org.apache.streampipes.manager.storage.UserService;
 import org.apache.streampipes.model.message.ErrorMessage;
 import org.apache.streampipes.model.message.Message;
@@ -60,7 +59,7 @@ public abstract class AbstractRestResource extends AbstractSharedRestInterface {
   }
 
   protected UserService getUserService() {
-    return UserManagementService.getUserService();
+    return new UserService(getUserStorage());
   }
 
   protected IVisualizationStorage getVisualizationStorage() {
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java
index d667c20..0f2bc3f 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java
@@ -25,7 +25,7 @@ import org.apache.streampipes.manager.file.FileManager;
 import org.apache.streampipes.manager.pipeline.PipelineCacheManager;
 import org.apache.streampipes.manager.pipeline.PipelineCanvasMetadataCacheManager;
 import org.apache.streampipes.manager.pipeline.PipelineManager;
-import org.apache.streampipes.manager.storage.UserManagementService;
+import org.apache.streampipes.resource.management.UserResourceManager;
 import org.apache.streampipes.model.client.file.FileMetadata;
 import org.apache.streampipes.model.connect.adapter.AdapterDescription;
 import org.apache.streampipes.model.datalake.DataLakeMeasure;
@@ -54,7 +54,7 @@ public class ResetManagement {
         logger.info("Start resetting the system");
 
         // Set hide tutorial to false for user
-        UserManagementService.setHideTutorial(username, true);
+        UserResourceManager.setHideTutorial(username, true);
 
         // Clear pipeline assembly Cache
         PipelineCacheManager.removeCachedPipeline(username);
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
index 94f0485..858e9e5 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
@@ -18,7 +18,9 @@
 
 package org.apache.streampipes.rest.impl;
 
-import org.apache.streampipes.manager.storage.UserManagementService;
+import org.apache.streampipes.commons.exceptions.UsernameAlreadyTakenException;
+import org.apache.streampipes.config.backend.BackendConfig;
+import org.apache.streampipes.config.backend.model.GeneralConfig;
 import org.apache.streampipes.model.client.user.*;
 import org.apache.streampipes.model.message.ErrorMessage;
 import org.apache.streampipes.model.message.NotificationType;
@@ -38,8 +40,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.HashMap;
+import java.util.Map;
 
 @Path("/v2/auth")
 public class Authentication extends AbstractRestResource {
@@ -82,17 +84,44 @@ public class Authentication extends AbstractRestResource {
   @Produces(MediaType.APPLICATION_JSON)
   @Consumes(MediaType.APPLICATION_JSON)
   public Response doRegister(RegistrationData data) {
-
-    Set<Role> roles = new HashSet<>();
-    roles.add(data.getRole());
-    if (getUserStorage().emailExists(data.getEmail())) {
-      return ok(Notifications.error("This email address already exists. Please choose another address."));
-    } else {
-      new UserManagementService().registerUser(data, roles);
+    GeneralConfig config = BackendConfig.INSTANCE.getGeneralConfig();
+    if (!config.isAllowSelfRegistration()) {
+      throw new WebApplicationException(Response.Status.FORBIDDEN);
+    }
+    data.setRoles(config.getDefaultUserRoles());
+    try {
+      getSpResourceManager().manageUsers().registerUser(data);
       return ok(new SuccessMessage(NotificationType.REGISTRATION_SUCCESS.uiNotification()));
+    } catch (UsernameAlreadyTakenException e) {
+      return badRequest(Notifications.error("This email address already exists. Please choose another address."));
+    }
+  }
+
+  @Path("restore/{username}")
+  @POST
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response sendPasswordRecoveryLink(@PathParam("username") String username) {
+    try {
+      getSpResourceManager().manageUsers().sendPasswordRecoveryLink(username);
+      return ok(new SuccessMessage(NotificationType.PASSWORD_RECOVERY_LINK_SENT.uiNotification()));
+    } catch (Exception e) {
+      return badRequest(Notifications.error("The username you entered is not registered."));
     }
   }
 
+  @Path("settings")
+  @GET
+  @JacksonSerialized
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response getAuthSettings() {
+    GeneralConfig config = BackendConfig.INSTANCE.getGeneralConfig();
+    Map<String, Object> response = new HashMap<>();
+    response.put("allowSelfRegistration", config.isAllowSelfRegistration());
+    response.put("allowPasswordRecovery", config.isAllowPasswordRecovery());
+
+    return ok(response);
+  }
+
   private Response processAuth(org.springframework.security.core.Authentication auth) {
     Principal principal = ((PrincipalUserDetails<?>) auth.getPrincipal()).getDetails();
     if (principal instanceof UserAccount) {
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RestorePasswordResource.java
similarity index 86%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RestorePasswordResource.java
index 5ace2ec..079014f 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RestorePasswordResource.java
@@ -15,10 +15,8 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.rest.impl;
+
+public class RestorePasswordResource {
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
 }
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/UserRegistrationResource.java
similarity index 73%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/UserRegistrationResource.java
index 5ace2ec..e3ffe10 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/UserRegistrationResource.java
@@ -15,10 +15,15 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.rest.impl;
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
+
+import javax.ws.rs.core.Response;
+
+public class UserRegistrationResource extends AbstractAuthGuardedRestResource {
+
+  public Response registerUser() {
+   return ok();
+  }
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java
index 4d3314a..4575b88 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java
@@ -60,7 +60,7 @@ public class EmailConfigurationResource extends AbstractAuthGuardedRestResource
     try {
       new MailTester().sendTestMail(config);
       return ok();
-    } catch (MailException e) {
+    } catch (MailException | IllegalArgumentException e) {
       return badRequest(e);
     }
   }
diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserStorage.java
index be374cf..6fb397c 100644
--- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserStorage.java
+++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IUserStorage.java
@@ -39,8 +39,6 @@ public interface IUserStorage {
 
   void updateUser(Principal user);
 
-  boolean emailExists(String email);
-
   boolean checkUser(String username);
 
   void deleteUser(String principalId);
diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserStorage.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserStorage.java
index a9e8c40..3d8650f 100644
--- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserStorage.java
+++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/UserStorage.java
@@ -95,15 +95,6 @@ public class UserStorage extends CrudViewDao implements IUserStorage {
     update(user, Principal.class);
   }
 
-  @Override
-  public boolean emailExists(String email) {
-    List<UserAccount> users = getAllUserAccounts();
-    return users
-            .stream()
-            .filter(u -> u.getEmail() != null)
-            .anyMatch(u -> u.getEmail().equals(email));
-  }
-
   /**
    * @param username
    * @return True if user exists exactly once, false otherwise
diff --git a/streampipes-user-management/src/main/java/org/apache/streampipes/user/management/jwt/JwtTokenProvider.java b/streampipes-user-management/src/main/java/org/apache/streampipes/user/management/jwt/JwtTokenProvider.java
index 5a8a80f..d905a9a 100644
--- a/streampipes-user-management/src/main/java/org/apache/streampipes/user/management/jwt/JwtTokenProvider.java
+++ b/streampipes-user-management/src/main/java/org/apache/streampipes/user/management/jwt/JwtTokenProvider.java
@@ -78,7 +78,6 @@ public class JwtTokenProvider {
 															Set<String> roles) {
 		UserInfo userInfo = new UserInfo();
 		userInfo.setUsername(localUser.getUsername());
-		userInfo.setEmail(localUser.getEmail());
 		userInfo.setDisplayName(localUser.getUsername());
 		userInfo.setShowTutorial(!localUser.isHideTutorial());
 		userInfo.setRoles(roles);
diff --git a/ui/deployment/app-routing.module.mst b/ui/deployment/app-routing.module.mst
index b313701..b7a4f68 100644
--- a/ui/deployment/app-routing.module.mst
+++ b/ui/deployment/app-routing.module.mst
@@ -34,6 +34,10 @@ import {ProfileComponent} from "./profile/profile.component";
 import {ApidocsComponent} from "./apidocs/apidocs.component";
 import { PageName } from './_enums/page-name.enum';
 import { PageAuthGuard } from './_guards/page-auth.can-active.guard';
+import { RegisterComponent } from './login/components/register/register.component';
+import { RestorePasswordComponent } from './login/components/restore-password/restore-password.component';
+import { RegistrationAllowedCanActivateGuard } from './_guards/registration-allowed.can-activate.guard';
+import { RestorePasswordAllowedCanActivateGuard } from './_guards/restore-password-allowed.can-activate.guard';
 
 {{#modulesActive}}
 {{#ng5}}
@@ -45,7 +49,8 @@ const routes: Routes = [
   { path: 'apidocs', component: ApidocsComponent, canActivate: [ConfiguredCanActivateGuard]},
   { path: 'login', component: LoginComponent, canActivate: [ConfiguredCanActivateGuard],
   data: {animation: 'LoginPage'}},
-  { path: 'setup', component: SetupComponent, canActivate: [AlreadyConfiguredCanActivateGuard] },
+  { path: 'register', component: RegisterComponent, canActivate: [RegistrationAllowedCanActivateGuard] },
+  { path: 'restore-password', component: RestorePasswordComponent, canActivate: [RestorePasswordAllowedCanActivateGuard] },
   { path: 'startup', component: StartupComponent },
   { path: 'standalone/:dashboardId', component: StandaloneDashboardComponent },
   { path: '', component: StreampipesComponent, children: [
@@ -69,7 +74,9 @@ const routes: Routes = [
       AuthCanActivateChildrenGuard,
       AlreadyConfiguredCanActivateGuard,
       ConfiguredCanActivateGuard,
-      PageAuthGuard
+      PageAuthGuard,
+      RegistrationAllowedCanActivateGuard,
+      RestorePasswordAllowedCanActivateGuard,
   ]
 })
 export class AppRoutingModule { }
diff --git a/ui/src/app/_guards/already-configured.can-activate.guard.ts b/ui/src/app/_guards/already-configured.can-activate.guard.ts
index 874819f..5d51100 100644
--- a/ui/src/app/_guards/already-configured.can-activate.guard.ts
+++ b/ui/src/app/_guards/already-configured.can-activate.guard.ts
@@ -36,8 +36,4 @@ export class AlreadyConfiguredCanActivateGuard extends BaseConfiguredCanActivate
   onIsUnconfigured(): boolean | UrlTree {
     return true;
   }
-
-
-
-
 }
diff --git a/ui/src/app/_guards/already-configured.can-activate.guard.ts b/ui/src/app/_guards/registration-allowed.can-activate.guard.ts
similarity index 54%
copy from ui/src/app/_guards/already-configured.can-activate.guard.ts
copy to ui/src/app/_guards/registration-allowed.can-activate.guard.ts
index 874819f..dbd4867 100644
--- a/ui/src/app/_guards/already-configured.can-activate.guard.ts
+++ b/ui/src/app/_guards/registration-allowed.can-activate.guard.ts
@@ -17,27 +17,28 @@
  */
 
 import { Injectable } from '@angular/core';
-import { Router, UrlTree } from '@angular/router';
-import { AuthService } from '../services/auth.service';
-import { BaseConfiguredCanActivateGuard } from './base-configured.can-activate.guard';
+import {
+  ActivatedRouteSnapshot,
+  CanActivate,
+  Router,
+  RouterStateSnapshot,
+  UrlTree
+} from '@angular/router';
+import { LoginService } from '../login/services/login.service';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
 
 @Injectable()
-export class AlreadyConfiguredCanActivateGuard extends BaseConfiguredCanActivateGuard {
+export class RegistrationAllowedCanActivateGuard implements CanActivate {
 
-  constructor(router: Router,
-              authService: AuthService) {
-    super(router, authService);
+  constructor(private router: Router,
+              private loginService: LoginService) {
   }
 
-  onIsConfigured(): boolean | UrlTree {
-    return this.router.parseUrl('login');
+  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
+    return this.loginService.fetchLoginSettings().pipe(map(config => {
+      return config.allowSelfRegistration ? true : this.router.parseUrl('register');
+    }));
   }
 
-  onIsUnconfigured(): boolean | UrlTree {
-    return true;
-  }
-
-
-
-
 }
diff --git a/ui/src/app/_guards/already-configured.can-activate.guard.ts b/ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts
similarity index 54%
copy from ui/src/app/_guards/already-configured.can-activate.guard.ts
copy to ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts
index 874819f..8be421b 100644
--- a/ui/src/app/_guards/already-configured.can-activate.guard.ts
+++ b/ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts
@@ -17,27 +17,26 @@
  */
 
 import { Injectable } from '@angular/core';
-import { Router, UrlTree } from '@angular/router';
-import { AuthService } from '../services/auth.service';
-import { BaseConfiguredCanActivateGuard } from './base-configured.can-activate.guard';
+import {
+  ActivatedRouteSnapshot,
+  CanActivate,
+  Router,
+  RouterStateSnapshot,
+  UrlTree
+} from '@angular/router';
+import { LoginService } from '../login/services/login.service';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
 
 @Injectable()
-export class AlreadyConfiguredCanActivateGuard extends BaseConfiguredCanActivateGuard {
+export class RestorePasswordAllowedCanActivateGuard implements CanActivate {
 
-  constructor(router: Router,
-              authService: AuthService) {
-    super(router, authService);
+  constructor(private router: Router,
+              private loginService: LoginService) {
   }
 
-  onIsConfigured(): boolean | UrlTree {
-    return this.router.parseUrl('login');
+  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
+    return this.loginService.fetchLoginSettings().pipe(map(config => config.allowPasswordRecovery ? true : this.router.parseUrl('login')));
   }
 
-  onIsUnconfigured(): boolean | UrlTree {
-    return true;
-  }
-
-
-
-
 }
diff --git a/ui/src/app/app-routing.module.ts b/ui/src/app/app-routing.module.ts
index b9d63bb..c2a6d14 100644
--- a/ui/src/app/app-routing.module.ts
+++ b/ui/src/app/app-routing.module.ts
@@ -34,6 +34,10 @@ import {ProfileComponent} from "./profile/profile.component";
 import {ApidocsComponent} from "./apidocs/apidocs.component";
 import { PageName } from './_enums/page-name.enum';
 import { PageAuthGuard } from './_guards/page-auth.can-active.guard';
+import { RegisterComponent } from './login/components/register/register.component';
+import { RestorePasswordComponent } from './login/components/restore-password/restore-password.component';
+import { RegistrationAllowedCanActivateGuard } from './_guards/registration-allowed.can-activate.guard';
+import { RestorePasswordAllowedCanActivateGuard } from './_guards/restore-password-allowed.can-activate.guard';
 
 import { EditorComponent } from './editor/editor.component';
 import { PipelinesComponent } from './pipelines/pipelines.component';
@@ -49,7 +53,8 @@ const routes: Routes = [
   { path: 'apidocs', component: ApidocsComponent, canActivate: [ConfiguredCanActivateGuard]},
   { path: 'login', component: LoginComponent, canActivate: [ConfiguredCanActivateGuard],
   data: {animation: 'LoginPage'}},
-  { path: 'setup', component: SetupComponent, canActivate: [AlreadyConfiguredCanActivateGuard] },
+  { path: 'register', component: RegisterComponent, canActivate: [RegistrationAllowedCanActivateGuard] },
+  { path: 'restore-password', component: RestorePasswordComponent, canActivate: [RestorePasswordAllowedCanActivateGuard] },
   { path: 'startup', component: StartupComponent },
   { path: 'standalone/:dashboardId', component: StandaloneDashboardComponent },
   { path: '', component: StreampipesComponent, children: [
@@ -77,6 +82,8 @@ const routes: Routes = [
       AuthCanActivateChildrenGuard,
       AlreadyConfiguredCanActivateGuard,
       ConfiguredCanActivateGuard,
+      RegistrationAllowedCanActivateGuard,
+      RestorePasswordAllowedCanActivateGuard,
       PageAuthGuard
   ]
 })
diff --git a/ui/src/app/configuration/email-configuration/email-configuration.component.html b/ui/src/app/configuration/email-configuration/email-configuration.component.html
index fa1e1ab..8a19dc5 100644
--- a/ui/src/app/configuration/email-configuration/email-configuration.component.html
+++ b/ui/src/app/configuration/email-configuration/email-configuration.component.html
@@ -101,11 +101,24 @@
                     <i class="material-icons">save</i><span>&nbsp;Save</span>
                 </button>
                 <button mat-button mat-raised-button class="mat-basic" (click)="sendTestMail()" style="margin-right:10px;"
-                        [disabled]="!parentForm.valid"
+                        [disabled]="!parentForm.valid || sendingTestMailInProgress"
                         data-cy="sp-element-email-config-test">
                     <span>Send Test Mail</span>
                 </button>
                 </div>
+                <div fxLayout="column" *ngIf="attemptSendingTestMail">
+                    <div fxLayout="row" *ngIf="sendingTestMailInProgress">
+                        <mat-progress-spinner diameter="10"></mat-progress-spinner>
+                        <h5>Trying to send test mail test mail...</h5>
+                    </div>
+                    <div fxLayout="row">
+                        <h5 *ngIf="!sendingTestMailInProgress && sendingTestMailSuccess">Success</h5>
+                        <div fxLayout="column" *ngIf="!sendingTestMailInProgress && !sendingTestMailSuccess">
+                            Failure
+                            <h5>{{sendingEmailErrorMessage}}</h5>
+                        </div>
+                    </div>
+                </div>
             </form>
         </sp-split-section>
     </div>
diff --git a/ui/src/app/configuration/email-configuration/email-configuration.component.ts b/ui/src/app/configuration/email-configuration/email-configuration.component.ts
index 3425077..da15300 100644
--- a/ui/src/app/configuration/email-configuration/email-configuration.component.ts
+++ b/ui/src/app/configuration/email-configuration/email-configuration.component.ts
@@ -34,6 +34,11 @@ export class EmailConfigurationComponent implements OnInit {
   formReady = false;
   defaultRecipient = '';
 
+  attemptSendingTestMail = false;
+  sendingTestMailInProgress = false;
+  sendingTestMailSuccess = false;
+  sendingEmailErrorMessage = '';
+
   constructor(private fb: FormBuilder,
               private mailConfigService: MailConfigService) {}
 
@@ -102,11 +107,17 @@ export class EmailConfigurationComponent implements OnInit {
   }
 
   sendTestMail() {
+    this.sendingEmailErrorMessage = '';
+    this.attemptSendingTestMail = true;
+    this.sendingTestMailInProgress = true;
     this.mailConfig.testRecipientAddress = this.defaultRecipient;
     this.mailConfigService.sendTestMail(this.mailConfig).subscribe(result => {
-      console.log(result);
+      this.sendingTestMailInProgress = false;
+      this.sendingTestMailSuccess = true;
     }, error => {
-
+      this.sendingTestMailInProgress = false;
+      this.sendingTestMailSuccess = false;
+      this.sendingEmailErrorMessage = error.error.localizedMessage;
     });
   }
 
diff --git a/ui/src/app/configuration/general-configuration/general-configuration.component.html b/ui/src/app/configuration/general-configuration/general-configuration.component.html
index f0f16ef..6a2b4c1 100644
--- a/ui/src/app/configuration/general-configuration/general-configuration.component.html
+++ b/ui/src/app/configuration/general-configuration/general-configuration.component.html
@@ -18,11 +18,13 @@
 
 <div fxLayout="column" class="page-container-padding">
     <div fxFlex="100" fxLayout="column" fxLayoutAlign="start start" *ngIf="formReady">
-        <sp-split-section title="Host and Port"
-                          subtitle="Basic accessibility settings">
-            <form [formGroup]="parentForm" fxFlex="100" fxLayout="column">
+        <form [formGroup]="parentForm" fxFlex="100" fxLayout="column">
+            <sp-split-section title="Host and Port"
+                              subtitle="Basic accessibility settings">
                 <div class="subsection-title">Host and Port</div>
-                <div class="warning mb-10" *ngIf="!generalConfig.configured">These are default values - to use features such as email you need to store these values once.</div>
+                <div class="warning mb-10" *ngIf="!generalConfig.configured">These are default values - to use features
+                    such as email you need to store these values once.
+                </div>
                 <div fxLayout="column" fxFlex="100">
                     <div fxLayout="row">
                         <div>
@@ -54,8 +56,36 @@
                         <i class="material-icons">save</i><span>&nbsp;Save</span>
                     </button>
                 </div>
-            </form>
-        </sp-split-section>
+            </sp-split-section>
+            <mat-divider></mat-divider>
+            <sp-split-section title="Registration"
+                              subtitle="Registration process">
+                <div class="warning mb-10" *ngIf="!generalConfig.configured || !mailConfig.emailConfigured">Requires valid
+                    mail server settings and basic host settings.
+                </div>
+                <mat-checkbox [disabled]="!generalConfig.configured || !mailConfig.emailConfigured"
+                              formControlName="allowSelfRegistration">Allow self-registration
+                </mat-checkbox>
+                <div *ngIf="generalConfig.allowSelfRegistration" class="mt-10 mb-10">
+                    <h5>Default roles for new users</h5>
+                    <mat-select formControlName="defaultUserRoles" [multiple]="true">
+                        <mat-option *ngFor="let role of availableRoles" [value]="role.role">{{role.roleTitle}}</mat-option>
+                    </mat-select>
+                </div>
+                <mat-checkbox [disabled]="!generalConfig.configured || !mailConfig.emailConfigured"
+                              formControlName="allowPasswordRecovery">Allow self-service password recovery
+                </mat-checkbox>
+
+                <div class="mt-10">
+                    <button mat-button mat-raised-button color="accent" (click)="updateConfig()"
+                            style="margin-right:10px;"
+                            [disabled]="!generalConfig.configured || !mailConfig.emailConfigured"
+                            data-cy="sp-element-general-registration-config-save">
+                        <i class="material-icons">save</i><span>&nbsp;Save</span>
+                    </button>
+                </div>
+            </sp-split-section>
+        </form>
     </div>
-    <mat-divider></mat-divider>
+
 </div>
diff --git a/ui/src/app/configuration/general-configuration/general-configuration.component.ts b/ui/src/app/configuration/general-configuration/general-configuration.component.ts
index 446484b..57bff33 100644
--- a/ui/src/app/configuration/general-configuration/general-configuration.component.ts
+++ b/ui/src/app/configuration/general-configuration/general-configuration.component.ts
@@ -20,6 +20,12 @@ import { Component, OnInit } from '@angular/core';
 import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
 import { GeneralConfigService } from '../../platform-services/apis/general-config.service';
 import { GeneralConfigModel } from '../../platform-services/model/general-config.model';
+import { MailConfigService } from '../../platform-services/apis/mail-config.service';
+import { zip } from 'rxjs';
+import { EmailConfig } from '../../platform-services/model/email-config.model';
+import { AvailableRolesService } from '../../services/available-roles.service';
+import { RoleDescription } from '../../_models/auth.model';
+import { UserRole } from '../../_enums/user-role.enum';
 
 @Component({
   selector: 'sp-general-configuration',
@@ -32,31 +38,47 @@ export class GeneralConfigurationComponent implements OnInit {
   formReady = false;
 
   generalConfig: GeneralConfigModel;
+  mailConfig: EmailConfig;
+
+  availableRoles: RoleDescription[];
 
   constructor(private fb: FormBuilder,
-              private generalConfigService: GeneralConfigService) {}
+              private generalConfigService: GeneralConfigService,
+              private mailConfigService: MailConfigService,
+              private availableRolesService: AvailableRolesService) {}
 
   ngOnInit(): void {
-    this.generalConfigService.getGeneralConfig().subscribe(config => {
-      if (config.configured) {
-        this.generalConfig = config;
+    this.availableRoles = this.availableRolesService.availableRoles.filter(role => role.role !== UserRole.ROLE_ADMIN);
+    zip(this.generalConfigService.getGeneralConfig(), this.mailConfigService.getMailConfig()).subscribe(configs => {
+      if (configs[0].configured) {
+        this.generalConfig = configs[0];
       } else {
         this.generalConfig = {
           configured: false,
           hostname: window.location.hostname,
           port: window.location.port as unknown as number,
-          protocol: window.location.protocol.replace(':', '') as unknown as 'http' | 'https'
+          protocol: window.location.protocol.replace(':', '') as unknown as 'http' | 'https',
+          allowSelfRegistration: false,
+          allowPasswordRecovery: false,
+          defaultUserRoles: [UserRole.ROLE_PIPELINE_USER]
         };
       }
+      this.mailConfig = configs[1];
       this.parentForm = this.fb.group({});
       this.parentForm.addControl('protocol', new FormControl(this.generalConfig.protocol, Validators.required));
       this.parentForm.addControl('port', new FormControl(this.generalConfig.port, Validators.required));
       this.parentForm.addControl('hostname', new FormControl(this.generalConfig.hostname, Validators.required));
-
+      this.parentForm.addControl('allowSelfRegistration', new FormControl(this.generalConfig.allowSelfRegistration));
+      this.parentForm.addControl('allowPasswordRecovery', new FormControl(this.generalConfig.allowPasswordRecovery));
+      this.parentForm.addControl('defaultUserRoles', new FormControl([UserRole.ROLE_PIPELINE_USER], Validators.required));
       this.parentForm.valueChanges.subscribe(v => {
         this.generalConfig.protocol = v.protocol;
         this.generalConfig.port = v.port;
         this.generalConfig.hostname = v.hostname;
+        this.generalConfig.allowPasswordRecovery = v.allowPasswordRecovery;
+        this.generalConfig.allowSelfRegistration = v.allowSelfRegistration;
+        this.generalConfig.defaultUserRoles = v.defaultUserRoles.map(r => UserRole[r]);
+        console.log(this.generalConfig);
       });
 
       this.formReady = true;
diff --git a/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.html b/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.html
index ea3017d..930cf0c 100644
--- a/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.html
+++ b/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.html
@@ -22,24 +22,25 @@
             <form [formGroup]="parentForm" fxFlex="100" fxLayout="column">
                 <div class="general-options-panel" fxLayout="column">
                     <span class="general-options-header">Basics</span>
-                    <mat-form-field color="accent">
+                    <mat-form-field color="accent" *ngIf="!isUserAccount">
                         <mat-label>Username</mat-label>
                         <input formControlName="username" fxFlex
                                matInput
                                required>
                     </mat-form-field>
                     <mat-form-field color="accent" *ngIf="isUserAccount">
-                        <mat-label>Full Name</mat-label>
-                        <input formControlName="fullName" fxFlex
+                        <mat-label>Email</mat-label>
+                        <input formControlName="username" fxFlex type="email"
                                matInput
                                required>
                     </mat-form-field>
                     <mat-form-field color="accent" *ngIf="isUserAccount">
-                        <mat-label>Email</mat-label>
-                        <input formControlName="email" fxFlex
+                        <mat-label>Full Name</mat-label>
+                        <input formControlName="fullName" fxFlex
                                matInput
                                required>
                     </mat-form-field>
+
                 </div>
                 <div fxLayout="column" class="general-options-panel" *ngIf="!editMode && isUserAccount">
                     <span class="general-options-header">Password</span>
diff --git a/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts b/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts
index b6357db..74ea318 100644
--- a/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts
+++ b/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts
@@ -80,7 +80,6 @@ export class EditUserDialogComponent implements OnInit {
     this.parentForm.addControl('accountEnabled', new FormControl(this.clonedUser.accountEnabled));
     this.parentForm.addControl('accountLocked', new FormControl(this.clonedUser.accountLocked));
     if (this.clonedUser instanceof UserAccount) {
-      this.parentForm.addControl('email', new FormControl(this.clonedUser.email));
       this.parentForm.addControl('fullName', new FormControl(this.clonedUser.fullName));
     } else {
       this.parentForm.addControl('clientSecret', new FormControl(this.clonedUser.clientSecret));
@@ -97,7 +96,6 @@ export class EditUserDialogComponent implements OnInit {
       this.clonedUser.accountLocked = v.accountLocked;
       this.clonedUser.accountEnabled = v.accountEnabled;
       if (this.clonedUser instanceof UserAccount) {
-        this.clonedUser.email = v.email;
         this.clonedUser.fullName = v.fullName;
         if (!this.editMode) {
           this.clonedUser.password = v.password;
diff --git a/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.html b/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.html
index 1120c9d..5fba31b 100644
--- a/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.html
+++ b/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.html
@@ -31,7 +31,7 @@
                 matSort>
 
             <ng-container matColumnDef="username">
-                <th mat-header-cell mat-sort-header *matHeaderCellDef>Username</th>
+                <th mat-header-cell mat-sort-header *matHeaderCellDef>Email</th>
                 <td mat-cell *matCellDef="let account">
                     <h4 style="margin-bottom:0px;">{{account.username}}</h4>
                 </td>
@@ -44,16 +44,6 @@
                 </td>
             </ng-container>
 
-            <ng-container matColumnDef="email">
-                <th mat-header-cell mat-sort-header *matHeaderCellDef>Email</th>
-                <td
-                        mat-cell
-                        data-cy="security-email"
-                        *matCellDef="let account">
-                    {{account.email}}
-                </td>
-            </ng-container>
-
             <ng-container matColumnDef="edit">
                 <th mat-header-cell *matHeaderCellDef class="text-right">Actions</th>
                 <td mat-cell *matCellDef="let account">
diff --git a/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.ts b/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.ts
index 39d34f1..91b5e12 100644
--- a/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.ts
+++ b/ui/src/app/configuration/security-configuration/security-user-configuration/security-user-config.component.ts
@@ -29,7 +29,7 @@ import { Observable } from 'rxjs';
 export class SecurityUserConfigComponent extends AbstractSecurityPrincipalConfig<UserAccount> {
 
 
-  displayedColumns: string[] = ['username', 'fullName', 'email', 'edit'];
+  displayedColumns: string[] = ['username', 'fullName', 'edit'];
 
 
   getObservable(): Observable<UserAccount[]> {
diff --git a/ui/src/app/connect/services/rest.service.ts b/ui/src/app/connect/services/rest.service.ts
index d4d31a3..19ec3d0 100644
--- a/ui/src/app/connect/services/rest.service.ts
+++ b/ui/src/app/connect/services/rest.service.ts
@@ -45,7 +45,7 @@ export class RestService {
   }
 
   addAdapterDescription(adapter: AdapterDescription, url: string): Observable<Message> {
-    adapter.userName = this.authService.getCurrentUser().email;
+    adapter.userName = this.authService.getCurrentUser().username;
     const promise = new Promise<Message>((resolve, reject) => {
       this.http
         .post(
diff --git a/ui/src/app/core-model/gen/streampipes-model-client.ts b/ui/src/app/core-model/gen/streampipes-model-client.ts
index 1787730..5def80c 100644
--- a/ui/src/app/core-model/gen/streampipes-model-client.ts
+++ b/ui/src/app/core-model/gen/streampipes-model-client.ts
@@ -18,7 +18,7 @@
 /* tslint:disable */
 /* eslint-disable */
 // @ts-nocheck
-// Generated using typescript-generator version 2.27.744 on 2021-11-02 20:08:48.
+// Generated using typescript-generator version 2.27.744 on 2021-11-04 13:01:00.
 
 export class ExtensionsServiceEndpointItem {
     appId: string;
@@ -230,7 +230,6 @@ export class ServiceAccount extends Principal {
 
 export class UserAccount extends Principal {
     darkMode: boolean;
-    email: string;
     fullName: string;
     hideTutorial: boolean;
     password: string;
@@ -245,7 +244,6 @@ export class UserAccount extends Principal {
         }
         const instance = target || new UserAccount();
         super.fromData(data, instance);
-        instance.email = data.email;
         instance.fullName = data.fullName;
         instance.password = data.password;
         instance.preferredDataStreams = __getCopyArrayFn(__identity<string>())(data.preferredDataStreams);
@@ -276,7 +274,6 @@ export class UserApiToken {
 export class UserInfo {
     darkMode: boolean;
     displayName: string;
-    email: string;
     roles: string[];
     showTutorial: boolean;
     username: string;
@@ -288,7 +285,6 @@ export class UserInfo {
         const instance = target || new UserInfo();
         instance.username = data.username;
         instance.displayName = data.displayName;
-        instance.email = data.email;
         instance.roles = __getCopyArrayFn(__identity<string>())(data.roles);
         instance.showTutorial = data.showTutorial;
         instance.darkMode = data.darkMode;
diff --git a/ui/src/app/core/components/iconbar/iconbar.component.ts b/ui/src/app/core/components/iconbar/iconbar.component.ts
index 5c818b1..958519a 100644
--- a/ui/src/app/core/components/iconbar/iconbar.component.ts
+++ b/ui/src/app/core/components/iconbar/iconbar.component.ts
@@ -50,7 +50,7 @@ export class IconbarComponent extends BaseNavigationComponent implements OnInit
     const passcode = 'admin';
     const websocketProtocol = window.location.protocol === 'http:' ? 'ws' : 'wss';
     const brokerUrl = websocketProtocol + '://' + window.location.hostname + ':' + window.location.port + '/streampipes/ws';
-    const inputTopic = '/topic/org.apache.streampipes.notifications.' + this.authService.getCurrentUser().email;
+    const inputTopic = '/topic/org.apache.streampipes.notifications.' + this.authService.getCurrentUser().username;
 
     const stompClient = new Client({
       brokerURL: brokerUrl,
diff --git a/ui/src/app/login/components/login/login.component.html b/ui/src/app/login/components/auth-box/auth-box.component.html
similarity index 51%
copy from ui/src/app/login/components/login/login.component.html
copy to ui/src/app/login/components/auth-box/auth-box.component.html
index 7af8745..0c00cc5 100644
--- a/ui/src/app/login/components/login/login.component.html
+++ b/ui/src/app/login/components/auth-box/auth-box.component.html
@@ -28,36 +28,7 @@
                             alt="icon" src="../../../../assets/img/login/logo.png" style="width:100%;">
                     </div>
                 </div>
-                <div fxFlex="100" fxLayout="column" fxLayoutAlign="center start">
-                    <h1>Login</h1>
-                </div>
-                <div fxFlex="100" fxLayout="column">
-                    <form #loginForm="ngForm" fxFlex="100" fxLayout="column">
-                        <div fxFlex="100" fxLayout="column">
-                            <mat-form-field fxFlex color="accent">
-                                <mat-label>Email</mat-label>
-                                <input [(ngModel)]="credentials.username" matInput type="email" name="username" class="sp" required/>
-                            </mat-form-field>
-                            <mat-form-field fxFlex color="accent">
-                                <mat-label>Password</mat-label>
-                                <input [(ngModel)]="credentials.password" matInput name="password" type="password" class="sp" required/>
-                            </mat-form-field>
-                            <mat-checkbox [(ngModel)]="credentials.rememberMe" name="rememberMe" class="sp" color="accent">Remember Me</mat-checkbox>
-                        </div>
-                        <div class="form-actions" style="margin-top:20px;">
-                            <button mat-button mat-raised-button color="accent" (click)="logIn()"
-                                    [disabled]="!loginForm.form.valid || loading">
-                                <span *ngIf="loading">Logging in...</span>
-                                <span *ngIf="!loading">Login</span>
-                            </button>
-                            <mat-spinner [mode]="'indeterminate'" color="accent" [diameter]="20"
-                                         *ngIf="loading" style="margin-top:10px;"></mat-spinner>
-                            <div class="md-warn" *ngIf="authenticationFailed">
-                                <h4>The password you entered is incorrect. Please try again.</h4>
-                            </div>
-                        </div>
-                    </form>
-                </div>
+                <ng-content></ng-content>
             </div>
         </mat-card>
         <div fxFlex="100" fxLayout="column" fxLayoutAlign="center center">
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/auth-box/auth-box.component.scss
similarity index 86%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/auth-box/auth-box.component.scss
index 5ace2ec..13cbc4a 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/auth-box/auth-box.component.scss
@@ -15,10 +15,3 @@
  * limitations under the License.
  *
  */
-
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
-}
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/auth-box/auth-box.component.ts
similarity index 69%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/auth-box/auth-box.component.ts
index 5ace2ec..6ad5ad1 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/auth-box/auth-box.component.ts
@@ -16,9 +16,22 @@
  *
  */
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'sp-auth-box',
+  templateUrl: './auth-box.component.html',
+  styleUrls: ['./auth-box.component.scss']
+})
+export class AuthBoxComponent implements OnInit {
+
+
+  ngOnInit(): void {
+  }
+
+  openDocumentation() {
+    window.open('https://streampipes.apache.org/docs', '_blank');
+  }
+
+
 }
diff --git a/ui/src/app/login/components/login/login.component.html b/ui/src/app/login/components/login/login.component.html
index 7af8745..058423d 100644
--- a/ui/src/app/login/components/login/login.component.html
+++ b/ui/src/app/login/components/login/login.component.html
@@ -16,56 +16,43 @@
   ~
   -->
 
-<div class="md-padding full-background sp-fade light-mode" fxLayout="row" fxLayoutAlign="center center"
-     style="min-height:100vh !important;">
-    <div fxFlex="40" fxLayout="column" fxLayoutAlign="center center">
-        <mat-card class="card-100-center box-shadow-login" style="padding:20px;position:relative;top:-25px;">
-            <div fxFlex="100" fxLayout="column">
-                <div fxLayout="row" fxFlex="60" fxLayoutAlign="center center"
-                     style="margin-left:auto;margin-right:auto;">
-                    <div fxFlex="60" fxLayoutAlign="center center" fxLayout="row"
-                         style="color:white;width:100%;"><img
-                            alt="icon" src="../../../../assets/img/login/logo.png" style="width:100%;">
-                    </div>
-                </div>
+<sp-auth-box>
                 <div fxFlex="100" fxLayout="column" fxLayoutAlign="center start">
                     <h1>Login</h1>
                 </div>
                 <div fxFlex="100" fxLayout="column">
-                    <form #loginForm="ngForm" fxFlex="100" fxLayout="column">
+                    <form [formGroup]="parentForm" fxFlex="100" fxLayout="column" *ngIf="configReady">
                         <div fxFlex="100" fxLayout="column">
                             <mat-form-field fxFlex color="accent">
                                 <mat-label>Email</mat-label>
-                                <input [(ngModel)]="credentials.username" matInput type="email" name="username" class="sp" required/>
+                                <input formControlName="username" matInput name="username" class="sp" required/>
                             </mat-form-field>
                             <mat-form-field fxFlex color="accent">
                                 <mat-label>Password</mat-label>
-                                <input [(ngModel)]="credentials.password" matInput name="password" type="password" class="sp" required/>
+                                <input formControlName="password" matInput name="password" type="password" class="sp" required/>
                             </mat-form-field>
-                            <mat-checkbox [(ngModel)]="credentials.rememberMe" name="rememberMe" class="sp" color="accent">Remember Me</mat-checkbox>
                         </div>
                         <div class="form-actions" style="margin-top:20px;">
                             <button mat-button mat-raised-button color="accent" (click)="logIn()"
-                                    [disabled]="!loginForm.form.valid || loading">
+                                    [disabled]="!parentForm.valid || loading">
                                 <span *ngIf="loading">Logging in...</span>
                                 <span *ngIf="!loading">Login</span>
                             </button>
                             <mat-spinner [mode]="'indeterminate'" color="accent" [diameter]="20"
                                          *ngIf="loading" style="margin-top:10px;"></mat-spinner>
                             <div class="md-warn" *ngIf="authenticationFailed">
-                                <h4>The password you entered is incorrect. Please try again.</h4>
+                                <h5 class="login-error">User not found or incorrect password provided.<br/>Please try again.</h5>
+                            </div>
+                            <div fxLayout="row" class="mt-10">
+                                <div *ngIf="loginSettings.allowPasswordRecovery">
+                                    <a [routerLink]="['/restore-password']">Forgot password?</a>
+                                </div>
+                                <span style="margin-left: 5px; margin-right: 5px;" *ngIf="loginSettings.allowSelfRegistration && loginSettings.allowPasswordRecovery"> | </span>
+                                <div *ngIf="loginSettings.allowSelfRegistration">
+                                    <a [routerLink]="['/register']">Create new account</a>
+                                </div>
                             </div>
                         </div>
                     </form>
                 </div>
-            </div>
-        </mat-card>
-        <div fxFlex="100" fxLayout="column" fxLayoutAlign="center center">
-            <button mat-button mat-raised-button color="accent" (click)="openDocumentation()"
-                    style="min-width:0px;padding-left:20px;padding-right:20px;font-size:18px;">
-                View Docs
-            </button>
-            <span style="margin-top:10px;"><a routerLink="/apidocs" routerLinkActive="active">View API docs</a></span>
-        </div>
-    </div>
-</div>
+</sp-auth-box>
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/login/login.component.scss
similarity index 86%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/login/login.component.scss
index 5ace2ec..8e200d3 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/login/login.component.scss
@@ -16,9 +16,9 @@
  *
  */
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+.login-error {
+  background: #ffa2a2;
+  padding: 8px;
+  color: #3e3e3e;
+  border-radius: 5px;
 }
diff --git a/ui/src/app/login/components/login/login.component.ts b/ui/src/app/login/components/login/login.component.ts
index 3d170ca..2a5ae61 100644
--- a/ui/src/app/login/components/login/login.component.ts
+++ b/ui/src/app/login/components/login/login.component.ts
@@ -17,34 +17,55 @@
  */
 
 import { ShepherdService } from '../../../services/tour/shepherd.service';
-import { Component } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { LoginService } from '../../services/login.service';
 import { Router } from '@angular/router';
 import { AuthService } from '../../../services/auth.service';
+import { LoginModel } from './login.model';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
 
 @Component({
     selector: 'login',
-    templateUrl: './login.component.html'
+    templateUrl: './login.component.html',
+    styleUrls: ['./login.component.scss']
 })
-export class LoginComponent {
+export class LoginComponent implements OnInit {
 
-    loading: any;
-    authenticationFailed: any;
+    parentForm: FormGroup;
+    configReady = false;
+    loading: boolean;
+    authenticationFailed: boolean;
     credentials: any;
 
+    loginSettings: LoginModel;
+
     constructor(private loginService: LoginService,
                 private router: Router,
                 private shepherdService: ShepherdService,
-                private authService: AuthService) {
+                private authService: AuthService,
+                private fb: FormBuilder) {
         this.loading = false;
         this.authenticationFailed = false;
         this.credentials = {};
     }
 
-    openDocumentation() {
-       window.open('https://streampipes.apache.org/docs', '_blank');
+    ngOnInit() {
+      this.loginService.fetchLoginSettings().subscribe(result => {
+        this.loginSettings = result;
+        this.configReady = true;
+        this.parentForm = this.fb.group({});
+        this.parentForm.addControl('username', new FormControl('', Validators.required));
+        this.parentForm.addControl('password', new FormControl('', Validators.required));
+
+        this.parentForm.valueChanges.subscribe(v => {
+          this.credentials.username = v.username;
+          this.credentials.password = v.password;
+        });
+      });
     }
 
+
+
     logIn() {
         this.authenticationFailed = false;
         this.loading = true;
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/login/login.model.ts
similarity index 86%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/login/login.model.ts
index 5ace2ec..6e7dcef 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/login/login.model.ts
@@ -16,9 +16,7 @@
  *
  */
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+export interface LoginModel {
+  allowSelfRegistration: boolean;
+  allowPasswordRecovery: boolean;
 }
diff --git a/ui/src/app/login/components/register/register.component.html b/ui/src/app/login/components/register/register.component.html
new file mode 100644
index 0000000..e73a323
--- /dev/null
+++ b/ui/src/app/login/components/register/register.component.html
@@ -0,0 +1,65 @@
+<!--
+  ~ 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.
+  ~
+  -->
+
+<sp-auth-box>
+    <div fxFlex="100" fxLayout="column" fxLayoutAlign="center start">
+        <h1>Register</h1>
+    </div>
+    <div fxLayout="column" fxFlex="100">
+        <form [formGroup]="parentForm">
+            <div fxLayout="column">
+                <mat-form-field color="accent">
+                    <mat-label>Email</mat-label>
+                    <input formControlName="username" fxFlex
+                           matInput>
+                </mat-form-field>
+                <mat-form-field color="accent">
+                    <mat-label>Initial password</mat-label>
+                    <input formControlName="password" fxFlex
+                           type="password"
+                           matInput
+                           required>
+                </mat-form-field>
+                <mat-form-field color="accent">
+                    <mat-label>Repeat password</mat-label>
+                    <input formControlName="repeatPassword" fxFlex
+                           type="password"
+                           matInput
+                           required>
+                </mat-form-field>
+                <div class="form-actions" style="margin-top:20px;">
+                    <button mat-button mat-raised-button color="accent" (click)="registerUser()"
+                            [disabled]="!parentForm.valid" *ngIf="!registrationSuccess">
+                        <span>Register</span>
+                    </button>
+                    <mat-spinner [mode]="'indeterminate'" color="accent" [diameter]="20"
+                                 *ngIf="registrationInProcess" style="margin-top:10px;"></mat-spinner>
+                    <div class="md-warn" *ngIf="registrationError">
+                        <h5 class="info-box register-error">{{registrationError}}</h5>
+                    </div>
+                    <div class="md-success" *ngIf="registrationSuccess">
+                        <h5 class="info-box register-success">We've sent out a confirmation mail to this address and try again.</h5>
+                    </div>
+                    <div class="mt-10">
+                        <a [routerLink]="['/login']">Go to login page</a>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+</sp-auth-box>
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/register/register.component.scss
similarity index 82%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/register/register.component.scss
index 5ace2ec..9edda7d 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/register/register.component.scss
@@ -16,9 +16,17 @@
  *
  */
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+.info-box {
+  padding: 8px;
+  border-radius: 5px;
+}
+
+.register-error {
+  background: #ffa2a2;
+  color: #3e3e3e;
+}
+
+.register-success {
+  background: #a2ffa2;
+  color: #3e3e3e;
 }
diff --git a/ui/src/app/login/components/register/register.component.ts b/ui/src/app/login/components/register/register.component.ts
new file mode 100644
index 0000000..36cb1d9
--- /dev/null
+++ b/ui/src/app/login/components/register/register.component.ts
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ *
+ */
+
+import { Component, OnInit } from '@angular/core';
+import {
+  AbstractControl,
+  FormBuilder,
+  FormControl,
+  FormGroup, ValidationErrors,
+  ValidatorFn,
+  Validators
+} from '@angular/forms';
+import { RegistrationModel } from './registration.model';
+import { LoginService } from '../../services/login.service';
+
+@Component({
+  selector: 'sp-register-user',
+  templateUrl: './register.component.html',
+  styleUrls: ['./register.component.scss']
+})
+export class RegisterComponent implements OnInit {
+
+  parentForm: FormGroup;
+
+  registrationData: RegistrationModel;
+
+  registrationInProcess = false;
+  registrationSuccess = false;
+  registrationError: string;
+
+  constructor(private fb: FormBuilder,
+              private loginService: LoginService) {
+  }
+
+  ngOnInit(): void {
+    this.parentForm = this.fb.group({});
+    this.parentForm.addControl('username', new FormControl('', Validators.required));
+    this.parentForm.addControl('password', new FormControl('', Validators.required));
+    this.parentForm.addControl('repeatPassword', new FormControl('', Validators.required));
+    this.parentForm.setValidators(this.checkPasswords);
+
+    this.parentForm.valueChanges.subscribe((v) => {
+      this.registrationData = {username: v.username, password: v.password};
+    });
+  }
+
+  checkPasswords: ValidatorFn = (group: AbstractControl):  ValidationErrors | null => {
+    const pass = group.get('password');
+    const confirmPass = group.get('repeatPassword');
+
+    if (!pass || !confirmPass) {
+      return null;
+    }
+    return pass.value === confirmPass.value ? null : { notMatching: true };
+  }
+
+  registerUser() {
+    this.registrationError = undefined;
+    this.registrationInProcess = true;
+    this.loginService.registerUser(this.registrationData).subscribe(response => {
+      this.registrationInProcess = false;
+      this.registrationSuccess = true;
+      console.log("success");
+    }, error => {
+      this.registrationInProcess = false;
+      this.registrationSuccess = false;
+      this.registrationError = error.error.notifications[0].title;
+    console.log(error);
+    });
+  }
+
+
+}
+
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/register/registration.model.ts
similarity index 86%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/register/registration.model.ts
index 5ace2ec..6f14b16 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/register/registration.model.ts
@@ -16,9 +16,7 @@
  *
  */
 
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
+export interface RegistrationModel {
+  username: string;
+  password: string;
 }
diff --git a/ui/src/app/login/components/restore-password/restore-password.component.html b/ui/src/app/login/components/restore-password/restore-password.component.html
new file mode 100644
index 0000000..eeefeff
--- /dev/null
+++ b/ui/src/app/login/components/restore-password/restore-password.component.html
@@ -0,0 +1,42 @@
+<!--
+  ~ 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.
+  ~
+  -->
+
+
+<sp-auth-box>
+    <div fxFlex="100" fxLayout="column" fxLayoutAlign="center start">
+        <h1>Restore password</h1>
+        <h5>Enter your mail address and we'll send you a link to restore your password.</h5>
+    </div>
+    <div fxLayout="column" fxFlex="100">
+        <form [formGroup]="parentForm">
+            <div fxLayout="column">
+                <mat-form-field color="accent">
+                    <mat-label>Email</mat-label>
+                    <input formControlName="username" fxFlex
+                           matInput>
+                </mat-form-field>
+                <div class="form-actions" style="margin-top:20px;">
+                    <button mat-button mat-raised-button color="accent" (click)="sendRestorePasswordLink()"
+                            [disabled]="!parentForm.valid" *ngIf="!restoreSuccess">
+                        <span>Reset password</span>
+                    </button>
+                </div>
+            </div>
+        </form>
+    </div>
+</sp-auth-box>
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/login/components/restore-password/restore-password.component.scss
similarity index 86%
copy from ui/src/app/platform-services/model/general-config.model.ts
copy to ui/src/app/login/components/restore-password/restore-password.component.scss
index 5ace2ec..13cbc4a 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/login/components/restore-password/restore-password.component.scss
@@ -15,10 +15,3 @@
  * limitations under the License.
  *
  */
-
-export interface GeneralConfigModel {
-  hostname: string;
-  port: number;
-  protocol: 'http' | 'https';
-  configured: boolean;
-}
diff --git a/ui/src/app/login/components/restore-password/restore-password.component.ts b/ui/src/app/login/components/restore-password/restore-password.component.ts
new file mode 100644
index 0000000..ff3e642
--- /dev/null
+++ b/ui/src/app/login/components/restore-password/restore-password.component.ts
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ */
+
+import { Component, OnInit } from '@angular/core';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
+import { LoginService } from '../../services/login.service';
+
+@Component({
+  selector: 'sp-restore-password',
+  templateUrl: './restore-password.component.html',
+  styleUrls: ['./restore-password.component.scss']
+})
+export class RestorePasswordComponent implements OnInit {
+
+  parentForm: FormGroup;
+  restoreSuccess = false;
+
+  username: string;
+
+  constructor(private fb: FormBuilder,
+              private loginService: LoginService) {
+  }
+
+  ngOnInit(): void {
+    this.parentForm = this.fb.group({});
+    this.parentForm.addControl('username', new FormControl('', Validators.required));
+
+    this.parentForm.valueChanges.subscribe(result => {
+      this.username = result.username;
+    });
+  }
+
+  sendRestorePasswordLink() {
+    console.log('sendRestorePasswordLink');
+  }
+
+
+}
+
diff --git a/ui/src/app/login/login.module.ts b/ui/src/app/login/login.module.ts
index f763fa4..ec606ac 100644
--- a/ui/src/app/login/login.module.ts
+++ b/ui/src/app/login/login.module.ts
@@ -35,6 +35,9 @@ import { MatDividerModule } from '@angular/material/divider';
 import { MatProgressBarModule } from '@angular/material/progress-bar';
 import { LoginService } from './services/login.service';
 import { AppRoutingModule } from '../app-routing.module';
+import { AuthBoxComponent } from './components/auth-box/auth-box.component';
+import { RestorePasswordComponent } from './components/restore-password/restore-password.component';
+import { RegisterComponent } from './components/register/register.component';
 
 @NgModule({
   imports: [
@@ -55,7 +58,10 @@ import { AppRoutingModule } from '../app-routing.module';
     MatProgressBarModule,
   ],
   declarations: [
+    AuthBoxComponent,
     LoginComponent,
+    RegisterComponent,
+    RestorePasswordComponent,
     SetupComponent,
     StartupComponent,
   ],
diff --git a/ui/src/app/login/services/login.service.ts b/ui/src/app/login/services/login.service.ts
index d3ac74d..7845114 100644
--- a/ui/src/app/login/services/login.service.ts
+++ b/ui/src/app/login/services/login.service.ts
@@ -16,10 +16,13 @@
  *
  */
 
-import { Injectable } from '@angular/core';
+import { Injectable, OnInit } from '@angular/core';
 import { HttpClient } from '@angular/common/http';
 import { PlatformServicesCommons } from '../../platform-services/apis/commons.service';
 import { Observable } from 'rxjs';
+import { LoginModel } from '../components/login/login.model';
+import { map } from 'rxjs/operators';
+import { RegistrationModel } from '../components/register/registration.model';
 
 @Injectable()
 export class LoginService {
@@ -28,6 +31,10 @@ export class LoginService {
               private platformServicesCommons: PlatformServicesCommons) {
   }
 
+  fetchLoginSettings(): Observable<LoginModel> {
+    return this.http.get(`${this.platformServicesCommons.apiBasePath}/auth/settings`).pipe(map(res => res as LoginModel));
+  }
+
   login(credentials): Observable<any> {
     return this.http.post(this.platformServicesCommons.apiBasePath + '/auth/login', credentials);
   }
@@ -41,4 +48,14 @@ export class LoginService {
   setupInstall(setup, installationStep): Observable<any> {
     return this.http.post(this.platformServicesCommons.apiBasePath + '/setup/install/' + installationStep, setup);
   }
+
+  registerUser(registrationData: RegistrationModel) {
+    return this.http.post(this.platformServicesCommons.apiBasePath + '/auth/register', registrationData);
+  }
+
+  sendRestorePasswordLink(email: string): Observable<any> {
+    return this.http.post(`${this.platformServicesCommons.apiBasePath}/auth/restore/${email}`, {});
+  }
+
+
 }
diff --git a/ui/src/app/notifications/notifications.component.ts b/ui/src/app/notifications/notifications.component.ts
index 64a2371..4322bb6 100644
--- a/ui/src/app/notifications/notifications.component.ts
+++ b/ui/src/app/notifications/notifications.component.ts
@@ -70,7 +70,7 @@ export class NotificationsComponent implements OnInit, OnDestroy {
                 private notificationCountService: NotificationCountService) {
         this.notifications = [];
         this.unreadNotifications = [];
-        this.notificationTopic = NotificationsComponent.NOTIFICATION_TOPIC_PREFIX + this.authService.getCurrentUser().email;
+        this.notificationTopic = NotificationsComponent.NOTIFICATION_TOPIC_PREFIX + this.authService.getCurrentUser().username;
     }
 
     ngOnInit() {
diff --git a/ui/src/app/platform-services/model/general-config.model.ts b/ui/src/app/platform-services/model/general-config.model.ts
index 5ace2ec..8b8f423 100644
--- a/ui/src/app/platform-services/model/general-config.model.ts
+++ b/ui/src/app/platform-services/model/general-config.model.ts
@@ -21,4 +21,7 @@ export interface GeneralConfigModel {
   port: number;
   protocol: 'http' | 'https';
   configured: boolean;
+  allowPasswordRecovery: boolean;
+  allowSelfRegistration: boolean;
+  defaultUserRoles: string[];
 }
diff --git a/ui/src/app/profile/components/general/general-profile-settings.component.html b/ui/src/app/profile/components/general/general-profile-settings.component.html
index 8a16d4e..ee6eb36 100644
--- a/ui/src/app/profile/components/general/general-profile-settings.component.html
+++ b/ui/src/app/profile/components/general/general-profile-settings.component.html
@@ -21,14 +21,10 @@
         <sp-split-section title="Main Settings" subtitle="Manage your basic profile settings here.">
             <mat-form-field fxFlex>
                 <mat-label>Email</mat-label>
-                <input [(ngModel)]="userData.email" matInput type="email" name="email" disabled/>
+                <input [(ngModel)]="userData.username" matInput type="email" name="email" disabled/>
                 <mat-hint>Your mail address can't be changed currently.</mat-hint>
             </mat-form-field>
             <mat-form-field fxFlex>
-                <mat-label>Username</mat-label>
-                <input [(ngModel)]="userData.username" matInput/>
-            </mat-form-field>
-            <mat-form-field fxFlex>
                 <mat-label>Full Name</mat-label>
                 <input [(ngModel)]="userData.fullName" matInput/>
             </mat-form-field>