Index: src/mapservice-webclient/src/app/user/register.component.html
===================================================================
--- src/mapservice-webclient/src/app/user/register.component.html	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice-webclient/src/app/user/register.component.html	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -2,4 +2,5 @@
 <div class="header">
   <h1>Register</h1>
+  <alert></alert>
 </div>
 <div class="content">
@@ -35,4 +36,19 @@
           </div>
       </div>
+      <div class="pure-control-group">
+          <label for="password">E-Mail</label>
+          <input type="email" formControlName="email" [ngClass]="{ 'is-invalid': submitted && f.email.errors }" />
+          <div *ngIf="submitted && f.email.errors" class="invalid-feedback">
+              <div *ngIf="f.email.errors.required">E-Mail is required</div>
+          </div>
+      </div>
+      <div class="pure-control-group">
+          <label for="licenseAccepted"></label>
+          <input id="licenseAccepted" type="checkbox" formControlName="licenseAccepted" [ngClass]="{ 'is-invalid': submitted && f.licenseAccepted.errors }">
+          I agree to upload all date under the <a href="https://www.opendatacommons.org/licenses/odbl/summary/index.html" target="_blank">Open Data Commons Open Database License (ODbL)</a>
+          <div *ngIf="submitted && f.licenseAccepted.errors" class="invalid-feedback">
+              <div *ngIf="f.licenseAccepted.errors.required">Accepting the license is required</div>
+          </div>
+      </div>
       <div class="pure-controls">
           <button [disabled]="loading" class="pure-button pure-button-primary button-add">Register</button>
Index: src/mapservice-webclient/src/app/user/register.component.ts
===================================================================
--- src/mapservice-webclient/src/app/user/register.component.ts	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice-webclient/src/app/user/register.component.ts	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -34,5 +34,7 @@
             lastName: ['', Validators.required],
             username: ['', Validators.required],
-            password: ['', [Validators.required, Validators.minLength(6)]]
+            password: ['', [Validators.required, Validators.minLength(6)]],
+            email: ['', Validators.required],
+            licenseAccepted: ['', Validators.required]
         });
     }
Index: src/mapservice/codegen/code_generator
===================================================================
--- src/mapservice/codegen/code_generator	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/code_generator	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -25,4 +25,6 @@
 cp -a ../../../common/resources/* static/resources/
 cp -a ../../../common/icon/* static/resources/
+mkdir -p templates
+cp -a ../../templates/* templates/
 
 echo "Generating backend and client API code"
Index: src/mapservice/codegen/templates/__init__.mustache
===================================================================
--- src/mapservice/codegen/templates/__init__.mustache	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/templates/__init__.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -0,0 +1,8 @@
+import connexion
+from flask_cors import CORS
+from flask_mail import Mail
+
+app = connexion.App(__name__, specification_dir='./openapi/')
+application = app.app
+CORS(application)
+mail = Mail()
Index: src/mapservice/codegen/templates/__main__.mustache
===================================================================
--- src/mapservice/codegen/templates/__main__.mustache	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/templates/__main__.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -6,19 +6,10 @@
 {{/supportPython2}}
 
-import connexion
-from flask_cors import CORS
-#from flask import render_template
 import flask
 from sqlalchemy import event
 
-from {{packageName}} import encoder
-
+from {{packageName}} import encoder, app, application, mail
 from {{packageName}}.server_impl.database.Model import db, User, ApiKey, db_setup, db_test_setup
-
 from {{packageName}}.server_impl.ValidatorWorkaround import ValidatorWorkaround
-
-app = connexion.App(__name__, specification_dir='./openapi/')
-application = app.app
-CORS(application)
 
 @application.before_first_request
@@ -46,4 +37,5 @@
 
 	db.init_app(application)
+	mail.init_app(application)
 
 	app.run(port={{serverPort}})
Index: src/mapservice/codegen/templates/requirements.mustache
===================================================================
--- src/mapservice/codegen/templates/requirements.mustache	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/templates/requirements.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -8,4 +8,5 @@
 flask-sqlalchemy
 flask-cors
+flask-mail
 shapely
 geoalchemy2
Index: src/mapservice/openapi.yaml
===================================================================
--- src/mapservice/openapi.yaml	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/openapi.yaml	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -792,4 +792,6 @@
         activated:
           type: boolean
+        licenseAccepted:
+          type: boolean
         apiKeys:
           $ref: '#/components/schemas/apiKeys'
@@ -808,4 +810,6 @@
         password:
           type: string
+        licenseAccepted:
+          type: boolean
       required:
         - username
@@ -814,4 +818,5 @@
         - lastName
         - password
+        - licenseAccepted
     Water:
       title: Water
@@ -1158,4 +1163,5 @@
         lastName: Roe
         password: sdfl.1238_ASDkeil?
+        licenseAccepted: true
     Water:
       value:
Index: src/mapservice/src/server_impl/Config.py
===================================================================
--- src/mapservice/src/server_impl/Config.py	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/src/server_impl/Config.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -21,4 +21,8 @@
 	SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
 	SQLALCHEMY_TRACK_MODIFICATIONS = False
+	MAIL_SERVER = 'localhost'
+	MAIL_PORT = 25
+	MAIL_DEFAULT_SENDER = 'GNUBoat Mapservice <gnuboat@engsas.de>'
+	MAPSERVICE_WEBCLIENT = '/'
 
 class ProductionConfig(Config):
@@ -28,4 +32,5 @@
 	DEBUG = True
 	CREATE_TEST_DATABASE = True
+	MAPSERVICE_WEBCLIENT = 'http://localhost:8081'
 
 class TestingConfig(Config):
@@ -33,2 +38,3 @@
 	DEBUG = False
 	CREATE_TEST_DATABASE = True
+	MAPSERVICE_WEBCLIENT = 'http://localhost:8081'
Index: src/mapservice/src/server_impl/controllers/UsersController.py
===================================================================
--- src/mapservice/src/server_impl/controllers/UsersController.py	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/src/server_impl/controllers/UsersController.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -1,4 +1,4 @@
 '''
-    Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+    Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
 
     This program is free software: you can redistribute it and/or modify
@@ -19,10 +19,20 @@
 import datetime
 import hashlib
+import re
+import flask
+from flask import request, render_template
+from flask_mail import Message
 
+from openapi_server import mail
 from ..database.Model import User, ApiKey, db
 from ..HttpErrors import MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
 
+mail_regex = re.compile('[^@]+@[^@]+\.[^@]+')
+
 def users_activate(activationCode):
 	user = User.query.filter_by(activation_code=activationCode).all()
+	
+	webclient = flask.current_app.config['MAPSERVICE_WEBCLIENT']
+	
 	if len(user) != 1:
 		return 'Bad Request', 302, {'Location': 'activation_failed.html'}
@@ -31,5 +41,6 @@
 	user.activated = True
 	user.activation_code = ""
-	return 'Success', 302, {'Location': 'activation_succeeded.html'}
+	db.session.commit()
+	return 'Success', 302, {'Location': '{}/login'.format(webclient)}
 
 def users_api_key_create():
@@ -66,4 +77,43 @@
 		raise MapserviceUnauthorized
 	
+	return user_to_dict(user)
+
+def users_register(user_creation):
+	if user_creation is None:
+		raise MapserviceBadRequest(detail='No data specified')
+	if user_creation.username is None or user_creation.username == "":
+		raise MapserviceBadRequest(detail='No username given')
+	if user_creation.password is None or user_creation.password == "":
+		raise MapserviceBadRequest(detail='No password given')
+	if user_creation.first_name is None or user_creation.first_name == "":
+		raise MapserviceBadRequest(detail='No first name given')
+	if user_creation.last_name is None or user_creation.last_name == "":
+		raise MapserviceBadRequest(detail='No last name given')
+	if user_creation.email is None or user_creation.email == "":
+		raise MapserviceBadRequest(detail='No email given')
+	if not mail_regex.match(user_creation.email):
+		raise MapserviceBadRequest(detail='Email contains more than one @, no @ or no .')
+	if user_creation.license_accepted is None or not user_creation.license_accepted:
+		raise MapserviceBadRequest(detail='You must accept the license to register an account')
+	
+	# add user to the database
+	user = User.factory(user_creation.username, user_creation.password, user_creation.email)
+	user.first_name = user_creation.first_name
+	user.last_name = user_creation.last_name
+	user.license_accepted = user_creation.license_accepted
+	db.session.add(user)
+	db.session.commit()
+	
+	# send activation mail
+	activation_url = '{}/activate/{}'.format(request.base_url, user.activation_code)
+	
+	message = Message("Activate your GNUBoat account", recipients=[user.email])
+	message.body = 'Hello {},\nthank you for support the project with your own measurings. To activate your GNUBoat account, visit {}.\nKind regards,\nYour GNUBoat team'.format(user.first_name, activation_url)
+	message.html = render_template('activation_mail.html', first_name=user.first_name, activation_url=activation_url)
+	mail.send(message)
+	
+	return user_to_dict(user)
+
+def user_to_dict(user):
 	# create user dict and remove not needed entries
 	result = user.to_dict()
@@ -76,9 +126,3 @@
 	for apiKey in user.apikeys:
 		result['apiKeys'].append(apiKey.key)
-	
 	return result
-
-def users_register(user_creation):
-	print(user_creation)
-	
-	return 'Not Found', 500
Index: src/mapservice/src/server_impl/database/Model.py
===================================================================
--- src/mapservice/src/server_impl/database/Model.py	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/src/server_impl/database/Model.py	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -53,4 +53,5 @@
 	activation_code = db.Column(db.String(255), default='1234')
 	#activation_code = db.Column(db.String(255), server_default=text('LEFT(MD5(NOW()), 50)'))
+	license_accepted = db.Column(db.Boolean(), default=False)
 	
 	def to_dict(user):
@@ -63,5 +64,5 @@
 			'lastName': "",
 			'activated': user.activated,
-			
+			'licenseAccepted': user.license_accepted,
 		}
 		if user.first_name is not None:
@@ -382,5 +383,5 @@
 			test_user_john = query[0]
 		else:
-			test_user_john = User.factory('john', 'testpass2', 'john@example.org')
+			test_user_john = User.factory('john', 'testpass2', 'john@example.org', license_accepted=True)
 			test_user_john.activation_code = 'dac9630aec642a428cd73f4be0a03569'
 			db.session.add(test_user_john)
@@ -392,5 +393,5 @@
 			test_user_jane = query[0]
 		else:
-			test_user_jane = User.factory('jane', 'testpass', 'jane@example.org')
+			test_user_jane = User.factory('jane', 'testpass', 'jane@example.org', license_accepted=True)
 			test_user_jane.activated = True
 			test_user_jane.first_name = 'Jane'
Index: src/mapservice/templates/activation_mail.html
===================================================================
--- src/mapservice/templates/activation_mail.html	(revision bd0cb38e900c943ced620072feb0270b34682037)
+++ src/mapservice/templates/activation_mail.html	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -0,0 +1,5 @@
+<p>Hello {{first_name}},</p>
+<p>thank you for supporting the project with your own measurings. All your measurings are handled under the <a href="https://www.opendatacommons.org/licenses/odbl/summary/index.html" target="_blank">Open Data Commons Open Database License (ODbL)</a>, which you have already accepted. It is the same license as OpenStreetmap uses.</p>
+<p>To activate your GNUBoat account, you need ot visit <a href="{{activation_url}}">{{activation_url}}</a>.</p>
+<p>Kind regards,<br>
+Your GNUBOat team</p>
