-
Notifications
You must be signed in to change notification settings - Fork 12
Dice new flow #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Dice new flow #324
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| var qs = (function (a) { | ||
| if (a == "") return {}; | ||
| var b = {}; | ||
| for (var i = 0; i < a.length; ++i) { | ||
| var p = a[i].split("=", 2); | ||
| if (p.length == 1) b[p[0]] = ""; | ||
| else b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); | ||
| } | ||
| return b; | ||
| })(window.location.search.substr(1).split("&")); | ||
| $(document).ready(function () { | ||
| window.history.forward(); | ||
| const resendToken = qs["resendToken"]; | ||
| const canResend = qs["canResend"]; | ||
| const userId = qs["userId"]; | ||
| let formAction = qs["formAction"] || "#"; | ||
| const opt1 = 'https://auth.{{DOMAIN}}/continue'; | ||
| const opt2 = 'https://{{AUTH0DOMAIN}}/continue'; | ||
| if (!formAction.startsWith(opt1) && !formAction.startsWith(opt2)) { | ||
| // looks like XSS attack | ||
| formAction = "#"; | ||
| return false; | ||
| } | ||
| const apiServerUrl = "https://api.{{DOMAIN}}.com/v3/users"; | ||
| $("#continueBtn").click(function () { | ||
| var otp = $("#otp").val(); | ||
| if (!otp) { | ||
| $("#error").html("Need Password"); | ||
| $("#error").closest(".message").fadeIn(); | ||
| return false; | ||
| } | ||
| $("#error").closest(".message").fadeOut(); | ||
| $("#error").html(""); | ||
| $.ajax({ | ||
| type: "PUT", | ||
| url: apiServerUrl + "/activate", | ||
| contentType: "application/json", | ||
| mimeType: "application/json", | ||
| data: JSON.stringify({ | ||
| "param": { | ||
| userId, resendToken, otp | ||
| } | ||
| }), | ||
| dataType: "json", | ||
| success: function (result) { | ||
| $("#notify").html("Your account is activated"); | ||
| $("#notify").closest(".message").fadeIn(); | ||
| $("#resend-text").hide(); | ||
| $('#verifyOtp').attr('action', formAction); | ||
Check warningCode scanning / CodeQL Client-side URL redirect
Untrusted URL redirection due to [user-provided value](1).
|
||
| $("#state").val(qs["state"]); | ||
| $("#returnUrl").val(qs["returnUrl"]); | ||
| $("#otp").attr('disabled', 'disabled'); | ||
| $("#verifyOtp").submit(); | ||
| }, | ||
| error: function (error) { | ||
| if (error.responseJSON && error.responseJSON.result) { | ||
| $("#error").html(error.responseJSON.result.content); | ||
| $("#error").closest(".message").fadeIn(); | ||
| } else { | ||
| $("#error").html("Unknown Error"); | ||
| $("#error").closest(".message").fadeIn(); | ||
| } | ||
| } | ||
| }); | ||
| return false; | ||
| }); | ||
| if (canResend) { | ||
| $("#resend").click(function () { | ||
| $.ajax({ | ||
| type: "POST", | ||
| url: apiServerUrl + "/resendActivationEmail", | ||
| contentType: "application/json", | ||
| mimeType: "application/json", | ||
| data: JSON.stringify({ | ||
| "param": { | ||
| userId, resendToken | ||
| } | ||
| }), | ||
| dataType: "json", | ||
| success: function (result) { | ||
| $("#notify").html("Email sent"); | ||
| $("#notify").closest(".message").fadeIn(); | ||
| $("#resend-text").hide(); | ||
| }, | ||
| error: function (error) { | ||
| if (error.responseJSON && error.responseJSON.result) { | ||
| $("#error").html(error.responseJSON.result.content); | ||
| $("#error").closest(".message").fadeIn(); | ||
| $("#resend-text").hide(); | ||
| } else { | ||
| $("#error").html("Unknown Error"); | ||
| $("#error").closest(".message").fadeIn(); | ||
| } | ||
| } | ||
| }); | ||
| return false; | ||
| }); | ||
| } else { | ||
| $("#resend-text").hide(); | ||
| } | ||
|
|
||
| /** | ||
| * Script for field placeholder | ||
| **/ | ||
| $(".messages .close-error").on("click", function () { | ||
| $(this).closest(".message").fadeOut(); | ||
| }); | ||
| var inputObj = $(".input-field .input-text"), | ||
| continueBtnDisable = false; | ||
| inputObj | ||
| .on("focus", function () { | ||
| $(this).parent().addClass("active focussed"); | ||
| }) | ||
| .on("blur", function () { | ||
| var parentObj = $(this).parent(); | ||
| if ($(this).val() === "") { | ||
| parentObj.removeClass("active"); | ||
| } | ||
| parentObj.removeClass("focussed"); | ||
| }) | ||
| .on("change keydown paste input", function () { | ||
| var disableStatus = false; | ||
| inputObj.each(function (index, element) { | ||
| if ($(element).val() === "") { | ||
| disableStatus = true; | ||
| return; | ||
| } else { | ||
| disableStatus = false; | ||
| return; | ||
| } | ||
| }); | ||
| setContinueButtonDisabledStatus(disableStatus); | ||
| }) | ||
| .each(function (index, element) { | ||
| var parentObj = $(element).parent(); | ||
| if ($(element).val() !== "") { | ||
| parentObj.addClass("active"); | ||
| } else { | ||
| parentObj.removeClass("active"); | ||
| } | ||
|
|
||
| if ($(element).val() === "" && continueBtnDisable === false) { | ||
| continueBtnDisable = true; | ||
| } | ||
|
|
||
| setContinueButtonDisabledStatus(continueBtnDisable); | ||
| }); | ||
| }); | ||
| function setContinueButtonDisabledStatus(status) { | ||
| var continueBtnObj = $("#continueBtn"); | ||
| if (status) { | ||
| continueBtnObj.attr("disabled", true); | ||
| } else { | ||
| continueBtnObj.removeAttr("disabled"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Client-side cross-site scripting