summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html20
-rw-r--r--js/codeq/comms.js4
-rw-r--r--js/codeq/profile.js60
3 files changed, 47 insertions, 37 deletions
diff --git a/index.html b/index.html
index 243c553..15148ba 100644
--- a/index.html
+++ b/index.html
@@ -351,24 +351,32 @@
<h3 class="text-center">Sign up</h3>
</div>
<div class="modal-body">
- <form class="form" method="post">
- <div class="form-group" bs-has-error="">
+ <form id="formSignUp" class="form" action="">
+ <div class="form-group">
<label class="control-label small">Username</label>
<input class="form-control" name="username" id="modalSignUpUsername" type="text" placeholder="desired username" pattern="^[a-z,A-Z,0-9,_]{5,15}$" data-valid-min="5" title="Choose a alpha-numeric username of 5-15 characters" required="">
</div>
<div class="form-group">
+ <label class="control-label small">Display name</label>
+ <input class="form-control" name="name" id="modalSignUpName" type="text" placeholder="desired display name" title="Display name">
+ </div>
+ <div class="form-group">
+ <label class="control-label small">E-mail</label>
+ <input class="form-control" name="email" id="modalSignUpEmail" type="email" placeholder="email" title="E-mail" required="">
+ </div>
+ <div class="form-group">
<label class="control-label small">Password</label>
- <input class="form-control" name="password" id="modalSignUpPassword" type="password" placeholder="password" pattern="^[a-z,A-Z,0-9,_]{6,15}$" data-valid-min="6" title="Choose a alpha-numeric password of a least 6 characters" required="">
+ <input class="form-control" name="password" id="modalSignUpPassword" type="password" placeholder="password" pattern="^[a-z,A-Z,0-9,_]{6,}$" data-valid-min="6" title="Choose a alpha-numeric password of a least 6 characters" required="">
</div>
<div class="form-group">
<label class="control-label small">Verify (repeat password)</label>
- <input class="form-control" name="verify" id="modalSignUpVerify" type="password" placeholder="password (again)" pattern="^[a-z,A-Z,0-9,_]{6,15}$" data-valid-min="6" title="Choose a alpha-numeric password of a least 6 characters" required="">
+ <input class="form-control" name="verify" id="modalSignUpVerify" type="password" placeholder="password (again)" pattern="^[a-z,A-Z,0-9,_]{6,}$" data-valid-min="6" title="Choose a alpha-numeric password of a least 6 characters" required="">
</div>
</form><!--/row-->
</div><!--/modal-body-->
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true" data-toggle="modal" data-target="#modalLogIn">Cancel</button>
- <button class="btn btn-primary" id="btnSignUp" type="submit" onclick="codeq.profile.signup()">Sign up</button>
+ <input form="formSignUp" class="btn btn-primary" id="btnSignUp" type="submit" value="Sign up">
</div><!--/modal-footer-->
</div>
</div>
@@ -409,7 +417,7 @@
<h3 class="text-center">Arnes AAI</h3>
</div>
<div class="modal-body" style="padding: 0;">
- <iframe width="100%" height="500px" frameborder="0" scrolling="no" allowtransparency="true" src="https://codeq.si/login"></iframe>
+ <iframe width="100%" height="500px" frameborder="0" scrolling="no" allowtransparency="true" src="https://codeq.si/Shibboleth.sso/Login?forceAuthn=1"></iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
diff --git a/js/codeq/comms.js b/js/codeq/comms.js
index 54f5d24..ab168ff 100644
--- a/js/codeq/comms.js
+++ b/js/codeq/comms.js
@@ -367,10 +367,10 @@
return this.send({'action': 'logout'});
},
- 'signup': function (username, password) {
+ 'signup': function (username, name, email, password) {
var myself = this,
performSignUp = function () {
- return myself.send({'action': 'signup', 'username': username, 'password': password});
+ return myself.send({'action': 'signup', 'username': username, 'name': name, 'email': email, 'password': password});
};
if (socket) return performSignUp();
diff --git a/js/codeq/profile.js b/js/codeq/profile.js
index be0bb1e..687a3c7 100644
--- a/js/codeq/profile.js
+++ b/js/codeq/profile.js
@@ -4,37 +4,39 @@
(function(){
- codeq.profile = {
-
- 'signup': function () {
- var jqUsername = $("#modalSignUpUsername"),
- jqPassword = $("#modalSignUpPassword"),
- jqVerify = $("#modalSignUpVerify");
+ $('#formSignUp').submit(function(event) {
+ console.log($(this).serialize());
+ var jqUsername = $("#modalSignUpUsername"),
+ jqName = $("#modalSignUpName"),
+ jqEmail = $("#modalSignUpEmail"),
+ jqPassword = $("#modalSignUpPassword"),
+ jqVerify = $("#modalSignUpVerify");
- if (jqUsername.val() == "" || jqPassword.val() == "" || jqVerify.val() == "") {
- alert('Some fields are empty.');
- }
- else if (jqPassword.val() != jqVerify.val()) {
- alert('Passwords do not match.');
- }
- else {
- codeq.comms.signup(jqUsername.val(), jqPassword.val())
- .then(function (data) {
- //back to login
- $('#modalSignUp').modal('hide');
- alert('Welcome '+ jqUsername.val() +'. Thanks for signing up.');
- $('#modalLogIn').modal('show');
- //assume user wants to sign-in with signed username
- $("#username").val(jqUsername.val());
- //clear
- jqUsername.val('');
- jqPassword.val('');
- jqVerify.val('');
- })
- .done();
- }
+ if (jqPassword.val() != jqVerify.val()) {
+ alert('Passwords do not match.');
+ }
+ else {
+ codeq.comms.signup(jqUsername.val(), jqName.val(), jqEmail.val(), jqPassword.val())
+ .then(function (data) {
+ //back to login
+ $('#modalSignUp').modal('hide');
+ alert('Welcome '+ jqUsername.val() +'. Thanks for signing up.');
+ $('#modalLogIn').modal('show');
+ //assume user wants to sign-in with signed username
+ $("#username").val(jqUsername.val());
+ //clear
+ jqUsername.val('');
+ jqName.val('');
+ jqEmail.val('');
+ jqPassword.val('');
+ jqVerify.val('');
+ })
+ .done();
+ }
+ event.preventDefault(); // Prevent the form from submitting via the browser.
+ });
- },
+ codeq.profile = {
'changePassword': function () {
var jqNew = $("#modalChangePasswordNew"),