Commit e284ea6c authored by wannes's avatar wannes
Browse files

Merge master and resolve conflicts

parents d1c4385e c6858e50
This diff is collapsed.
......@@ -9,13 +9,53 @@ app = Flask(__name__,
static_url_path="")
@app.route("/api/reg/start", methods=['POST'])
def start():
# test data
if request.json["email"] != "test@test.com":
return json.dumps({
"errorKey": "INVALID_UNLOCK_KEY",
"message": "The unlock key used is invalid or has been used before",
"url": None
})
return json.dumps({
"user":
{
"id": 0,
"email": "test@test.com",
"name": None,
"lastName": None,
"street": None,
"postalCode": None,
"municipality": None,
"birthPlace": None,
"birthDate": None,
"enabled": False,
"certId": None,
"country": None
},
"timeInitiated": 1413231972887,
"ipv4Id": 0,
"ipv6Id": 0,
"unlockKey":
{
"key": "pouet",
"email": "test@test.com",
"usedAt": None
},
"completed": None,
"id": "7ed0cea2-1eef-43a9-b7db-b372aa67700f"
})
@app.route("/api/reg/validateKey", methods=['POST'])
def validate_key():
# test data
if request.json["email"] != "test@test.com" or request.json["key"] != "pouet":
return json.dumps({
"errorKey": "INVALID_UNLOCK_KEY",
"message":"The unlock key used is invalid or has been used before",
"message": "The unlock key used is invalid or has been used before",
"url": None
})
......@@ -49,6 +89,49 @@ def validate_key():
})
@app.route("/api/reg/enterPassword", methods=['POST'])
def enter_password():
return json.dumps({
"user":
{
"id": 0,
"email": "test@test.com",
"name": None,
"lastName": None,
"street": None,
"postalCode": None,
"municipality": None,
"birthPlace": None,
"birthDate": None,
"enabled": False,
"certId": None,
"country": None
},
"timeInitiated": 1413231972887,
"ipv4Id": 0,
"ipv6Id": 0,
"unlockKey":
{
"key": "pouet",
"email": "test@test.com",
"usedAt": None
},
"completed": None,
"id": "7ed0cea2-1eef-43a9-b7db-b372aa67700f"
})
@app.route("/eid")
def eid():
index = BeautifulSoup(open("../../web/registration/index.html", "r").read())
index('script')[-1].replaceWith("") # remove main.js
soup2 = BeautifulSoup('<div id="content" style="display: inline-block">' + open("../../web/registration/eid.html", "r").read() + '</div>')
index.find("div", id="content").replaceWith(soup2)
return str(index)
@app.route("/form")
def form():
index = BeautifulSoup(open("../../web/registration/index.html", "r").read())
......
......@@ -51,10 +51,10 @@ public class AddressLease extends ResourceBase {
}
@Put
public Representation create(Map<String, Object> data) {
int clientId = (int) data.get("client");
public Representation create(Map<String, String> data) {
int clientId = Integer.parseInt(data.get("client"));
assert clientId > 0;
int version = (int) data.get("version");
int version = Integer.parseInt(data.get("version"));
assert version == 4 || version == 6;
String purpose = IPAddress.Purpose.CLIENT_ASSIGN;
......@@ -107,10 +107,9 @@ public class AddressLease extends ResourceBase {
@Delete
public Representation deleteLease(Map<String, String> data) {
int ipVersion = Integer.parseInt(data.get("version"));
try {
if (data.containsKey("user")) {
int ipVersion = Integer.parseInt(data.get("version"));
List<IPAddress> addrs = IPAddresses.forClient(Clients.dao.queryForId(data.get("client")), ipVersion);
for (IPAddress addr : addrs) {
addr.client = Clients.NONE;
......
......@@ -123,7 +123,7 @@ textarea {
border-radius: 5px;
}
.form-control[type=text], .form-control[type=password], select.form-control {
.form-control[type=text], .form-control[type=password], select.form-control, .form-control[type=email] {
width: 69%;
background-image: linear-gradient(#DDD 0%, #FFF 100%);
border: solid 1px #000;
......@@ -137,12 +137,6 @@ textarea {
background-color: #333;
}
#applet-container {
background-color: #FFF;
padding: 15px;
box-shadow: 0 0 5px #555;
}
.box {
padding: 10px;
border: solid 1px #444;
......
<h2>eID identification</h2>
<p>We are obligated by telco law in Belgium to register data that must allow to correctly identify
the end users. This step will register this data using your eID. You will be given the opportunity to
correct any outdated information later on.</p>
<div class="form-control btn-info" id="manual-reg">Don't have an eID reader? Click here to follow the manual
registration procedure.
<h2>Choice of identification method</h2>
<p><i>We are obligated by telco law in Belgium to register data that must allow to correctly identify the end users.</i></p>
<div class="row">
<div class="col-md-6">
<h3>eID identification</h3>
<p>Choose this option to register using your eID. You will be given the opportunity to correct any outdated information later on.</p>
<p class="warning">You need to use a Java applet to do this. We're so sorry, there is no other way.</p>
<p>If you're unsure what is contained within the applet, the official source code is <a href="https://code.google.com/p/eid-idp/">here</a>.</p>
<button class="btn btn-primary" id="applet-container">Use your eID</button>
</div>
<div class="col-md-6">
<h3>Password identification</h3>
<p>Choose if you want to be able to log into the vpn using your email address and the password you have choosen at the beginning of this registration.</p>
<button class="btn btn-default" id="manual-reg">Use a password</button>
</div>
</div>
<p class="warning">We need to use a Java applet to do this. We're so sorry, there is no other way.<br/>
If you're unsure what is contained within the applet, the official source code is at (EID APPLET LINK)</p>
<div class="box" id="applet-container">Click to activate the Java applet</div>
<h2>Privacy</h2>
<p>We store the following information:</p>
<p>We store the following information when you use the eID:</p>
<ul>
<li>Full name (first + middle + last)</li>
<li>Address</li>
......@@ -18,4 +27,4 @@
</ul>
<p>We do not process and/or store anything else. To check for yourself, please find
the source code at <a href="https://github.com/Neutrinet/ISP-ng" xlink:title="GitHub link to control stack source">GitHub</a>
.</p>
\ No newline at end of file
.</p>
......@@ -164,7 +164,7 @@ function App() {
$('.unlock-key').hide();
}
$('form .btn-primary').click(function (event) {
$('form').submit(function (event) {
if (self.requireUnlockKey) {
self.vpn.validateKey($('#signup-email').val(), $('#signup-key').val());
} else {
......@@ -413,7 +413,7 @@ function App() {
$('#password').keyup(self.validatePassword);
$('#password-verify').keyup(self.validatePassword);
$('#password-done').click(function () {
$('#password-entry').submit(function () {
$.ajax(self.vpn.endpoint + 'api/reg/enterPassword', {
data: JSON.stringify({
id: self.vpn.registration.id,
......@@ -426,7 +426,7 @@ function App() {
self.vpn.registration['user'] = response;
app.content.hide();
app.preloader.fadeIn();
$('#content').load('eid.html', self.useEIDIdentification);
$('#content').load('eid.html?' + new Date().getTime(), self.useEIDIdentification);
}
});
});
......@@ -535,7 +535,7 @@ function App() {
app.preloader.hide();
app.content.show();
$('#reg').click(function () {
$('#reg-form').submit(function () {
var data = {};
var fields = $('#reg-form').children('input[type=text]');
......
......@@ -4,15 +4,15 @@
<form id="password-entry" action="" role="form">
<div class="form-group">
<label for="password" class="control-label label">Enter password (min 6 char): </label>
<input type="password" class="form-control" id="password" />
<input required="required" type="password" class="form-control" id="password" />
</div>
<div id="alert-password" class="hide alert alert-danger">Your password should be at least 6 characters long.</div>
<div class="form-group">
<label for="password-verify" class="control-label label">Verify your password:</label>
<input type="password" class="form-control" id="password-verify" />
<input required="required" type="password" class="form-control" id="password-verify" />
</div>
<div id="alert-password-verify" class="hide alert alert-danger">The two passwords don't match.</div>
<br />
<input type="button" id="password-done" class="btn form-control" value="Next" disabled />
<input type="submit" id="password-done" class="btn form-control" value="Next" disabled />
</form>
</div>
......@@ -3,17 +3,17 @@
<p>Alpha notice: there is no client-side form validation just yet</p>
<form action="" class="form-group" id="reg-form">
<label class="label" for="name">Name: </label>
<input type="text" id="name" class="form-control"/><br/>
<input required="required" type="text" id="name" class="form-control"/><br/>
<label class="label" for="last-name">Last name: </label>
<input type="text" id="last-name" class="form-control"/><br/>
<input required="required" type="text" id="last-name" class="form-control"/><br/>
<label class="label" for="street">Street: </label>
<input type="text" id="street" class="form-control"/><br/>
<input required="required" type="text" id="street" class="form-control"/><br/>
<label class="label" for="postal-code">Postal code: </label>
<input type="text" id="postal-code" class="form-control" maxlength="6"/><br/>
<input required="required" type="text" id="postal-code" class="form-control" maxlength="6"/><br/>
<label class="label" for="municipality">Town/City: </label>
<input type="text" id="municipality" class="form-control"/><br/>
<input required="required" type="text" id="municipality" class="form-control"/><br/>
<label class="label" for="birthplace">Birthplace: </label>
<input type="text" id="birthplace" class="form-control"/><br/>
<input required="required" type="text" id="birthplace" class="form-control"/><br/>
<p class="label">Birthdate:</p><br/>
<div id="birthdate"></div><br/>
<label class="label" for="country">Country: </label>
......@@ -25,7 +25,7 @@
<p>Cannot find your country in this list? Have a look at <a href="http://db.ffdn.org">
FFDN's list of associative ISPs</a> around the world!</p>
<input type="button" id="reg" value="Register" class="form-control btn-primary"/>
<input type="submit" id="reg" value="Register" class="form-control btn-primary"/>
</form>
<script>
......
......@@ -8,11 +8,11 @@
<form action="#" role="form">
<div class="form-group">
<label class="label control-label" for="signup-email">Email address</label><input class="form-control"
type="text"
id="signup-email"/><br>
type="email"
id="signup-email" required="required"/><br>
</div>
<input class="btn btn-primary form-control" type="button" value="Sign up!"/>
<input class="btn btn-primary form-control" type="submit" value="Sign up!"/>
</form>
<p>If you require help and/or would like to give us some feedback, <a href="http://neutrinet.be/index.php?title=Contact"
title="Contact">contact</a> us!</p>
\ No newline at end of file
title="Contact">contact</a> us!</p>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment