From 5f317837aa15193af6cb4535ba5c2f9c14ae905c Mon Sep 17 00:00:00 2001 From: Michael Truell Date: Sun, 1 Jan 2017 15:41:06 -0500 Subject: [PATCH 1/4] Add github email selection with some refactoring --- website/email.php | 19 ++++---- website/includes/email_custom_form.php | 21 +++++++++ website/includes/email_github_form.php | 36 +++++++++++++++ website/script/email.js | 63 +++++++------------------- 4 files changed, 82 insertions(+), 57 deletions(-) create mode 100644 website/includes/email_custom_form.php create mode 100644 website/includes/email_github_form.php diff --git a/website/email.php b/website/email.php index f1aaa94f6..bb1e51b0f 100644 --- a/website/email.php +++ b/website/email.php @@ -16,28 +16,27 @@ + +
-
+

One Last Step...

You need to enter your preferred email.

We’ll use the domain of your email address to identify your university or company so you can easily see how you rank against others in your organization. We’ll also email you about bot submission events like compilation errors. You can opt out of these at any time.

+ +

Or

+
-
+

Email Change

Please enter your preferred email.

We’ll use the domain of your email address to identify your university or company so you can easily see how you rank against others in your organization. We’ll also email you about bot submission events like compilation errors. You can opt out of these at any time.

- -
- - - -
-
- + diff --git a/website/includes/email_custom_form.php b/website/includes/email_custom_form.php new file mode 100644 index 000000000..c3ec1e4c1 --- /dev/null +++ b/website/includes/email_custom_form.php @@ -0,0 +1,21 @@ + +
+ + + +
diff --git a/website/includes/email_github_form.php b/website/includes/email_github_form.php new file mode 100644 index 000000000..540c543e5 --- /dev/null +++ b/website/includes/email_github_form.php @@ -0,0 +1,36 @@ + +
+ +
diff --git a/website/script/email.js b/website/script/email.js index 81ce62b06..7c6ef530e 100644 --- a/website/script/email.js +++ b/website/script/email.js @@ -1,57 +1,22 @@ $(function() { - var customEmailForm = { - $firstField: $("#firstField"), - $secondField: $("#secondField"), - $messageBox: $("#messageBox"), - $submitButton: $("#customSubmitButton"), - init: function(submitCallback) { - this.submitCallback = submitCallback; - this.$submitButton.click(this, this.onClick.bind(this)); - this.$firstField.keypress(this, this.keypress.bind(this)); - this.$secondField.keypress(this, this.keypress.bind(this)); - }, - render: function() { - this.$emailLoc.html(this.email); - }, - onClick: function() { - if(this.$firstField.val() != this.$secondField.val()) { - this.displayMessage("Email Mismatch", "The two emails that you entered do not match.", false); - } else if(this.$firstField.val() == "" || this.$secondField.val() == "") { - this.displayMessage("Empty Fields", "Please fill your email twice in the boxes below.", false); - } else { - this.displayMessage("Success", "We've sent a verification email to "+this.$firstField.val()+".", true); - this.submitCallback(this.$firstField.val()); - } - }, - keypress: function(e) { - if(e.which == 13) this.onClick(); - }, - displayMessage: function(title, message, isSuccess) { - this.$messageBox.append($("")) - } - } - function render() { if(parseInt(user.isEmailGood) == 0) { - if(user.email != null && user.email != undefined) { - $("#waitMessage").css("display", "block"); + if(user.email != null && user.email != undefined) { // Waiting for verification + $("#wait").css("display", "block"); - $("#forms").css("display", "none"); - $("#firstMessage").css("display", "none"); - $("#returningMessage").css("display", "none"); - } else { - $("#forms").css("display", "block"); - $("#firstMessage").css("display", "block"); + $("#change").css("display", "none"); + $("#verify").css("display", "none"); + } else { // Need to pick an email + $("#verify").css("display", "block"); - $("#waitMessage").css("display", "none"); - $("#returningMessage").css("display", "none"); + $("#change").css("display", "none"); + $("#wait").css("display", "none"); } - } else { - $("#forms").css("display", "block"); - $("#returningMessage").css("display", "block"); + } else { // Email change + $("#change").css("display", "block"); - $("#waitMessage").css("display", "none"); - $("#firstMessage").css("display", "none"); + $("#wait").css("display", "none"); + $("#verify").css("display", "none"); } } @@ -68,4 +33,8 @@ $(function() { user.email = email; render(user); }); + githubSubmitButton.init(function() { + validateEmail(email); + window.location.href = "index.php"; + }); }); From 75cba6885102fcacaad0e2e1e07da57fd45a99f1 Mon Sep 17 00:00:00 2001 From: Michael Truell Date: Sun, 1 Jan 2017 15:41:48 -0500 Subject: [PATCH 2/4] Take out jsrender --- website/email.php | 1 - 1 file changed, 1 deletion(-) diff --git a/website/email.php b/website/email.php index bb1e51b0f..b559748a3 100644 --- a/website/email.php +++ b/website/email.php @@ -46,7 +46,6 @@
- From d7ea271d89b9f83e8f73362effd8333ce9a82ba4 Mon Sep 17 00:00:00 2001 From: Michael Truell Date: Sun, 1 Jan 2017 15:50:13 -0500 Subject: [PATCH 3/4] Fixes to allowing github email registration --- website/email.php | 3 +- website/includes/email_custom_form.php | 39 ++++++++++++++++------- website/includes/email_github_form.php | 43 +++++++------------------- website/script/email.js | 4 +-- 4 files changed, 44 insertions(+), 45 deletions(-) diff --git a/website/email.php b/website/email.php index b559748a3..05842ea9b 100644 --- a/website/email.php +++ b/website/email.php @@ -38,7 +38,8 @@

We've sent you a verification email and are waiting for you to click the link in it. This email may land in your spam folder.

-

If you've already verified your email, head to our homepage. If you're having problems with registration, please email us at halite@halite.io.

+

If you've already verified your email, head to our homepage. If you're having problems with registration, please email us at halite@halite.io or switch to using your github email: .

+
diff --git a/website/includes/email_custom_form.php b/website/includes/email_custom_form.php index c3ec1e4c1..2e12f2ac0 100644 --- a/website/includes/email_custom_form.php +++ b/website/includes/email_custom_form.php @@ -1,16 +1,33 @@ diff --git a/website/includes/email_github_form.php b/website/includes/email_github_form.php index 540c543e5..5fd668b78 100644 --- a/website/includes/email_github_form.php +++ b/website/includes/email_github_form.php @@ -1,36 +1,17 @@ -
- -
+ diff --git a/website/script/email.js b/website/script/email.js index 7c6ef530e..ef559f63d 100644 --- a/website/script/email.js +++ b/website/script/email.js @@ -33,8 +33,8 @@ $(function() { user.email = email; render(user); }); - githubSubmitButton.init(function() { - validateEmail(email); + githubSubmitButton.init(user.githubEmail, function() { + validateEmail(); window.location.href = "index.php"; }); }); From 160b10f2d6e6efdb801a5a6338c01e378b6d0d9f Mon Sep 17 00:00:00 2001 From: Michael Truell Date: Sun, 1 Jan 2017 17:14:29 -0500 Subject: [PATCH 4/4] Additions to github email verify --- website/email.php | 17 ++++++++------- website/includes/email_custom_form.php | 29 +++++++++++++------------- website/includes/email_github_form.php | 15 +++++++++---- website/script/email.js | 2 +- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/website/email.php b/website/email.php index 05842ea9b..7f4c5ec60 100644 --- a/website/email.php +++ b/website/email.php @@ -23,20 +23,22 @@
-
+ -
+ -
+ + diff --git a/website/includes/email_custom_form.php b/website/includes/email_custom_form.php index 2e12f2ac0..9e4a6f156 100644 --- a/website/includes/email_custom_form.php +++ b/website/includes/email_custom_form.php @@ -1,38 +1,37 @@ -
- - - -
+ + + diff --git a/website/includes/email_github_form.php b/website/includes/email_github_form.php index 5fd668b78..b1c7828f3 100644 --- a/website/includes/email_github_form.php +++ b/website/includes/email_github_form.php @@ -1,17 +1,24 @@ - + diff --git a/website/script/email.js b/website/script/email.js index ef559f63d..bbe552a2d 100644 --- a/website/script/email.js +++ b/website/script/email.js @@ -20,7 +20,7 @@ $(function() { } } - var session = getSession(); + var session = getSession(); session = {"userID": 4431}; if(session == null) window.location.href = "index.php"; var user = getUser(session['userID']); if(user == null) window.location.href = "index.php";