Skip to content

Commit

Permalink
Merge pull request #2452 from mozilla/merge/mk-034-account-exists
Browse files Browse the repository at this point in the history
Some attempts to better address the errors happening on stage
  • Loading branch information
toufali authored Jan 12, 2022
2 parents 4027581 + 5ed48c0 commit 9418a57
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
7 changes: 5 additions & 2 deletions controllers/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ async function confirmed(req, res, next, client = FxAOAuthClient) {
//DATA REMOVAL SPECIFIC
const post_auth_redirect = req.session.post_auth_redirect;
let returnURL;

if (existingUser && (await checkIfOnRemovalPilotList(existingUser))) {
const isOnRemovalPilotList = await checkIfOnRemovalPilotList(existingUser);
if (isOnRemovalPilotList) {
req.session.kanary = { onRemovalPilotList: true };
}

if (existingUser && isOnRemovalPilotList) {
//if they are an existing user and on the pilot list, use pilot redirect
if (post_auth_redirect) {
returnURL = new URL(post_auth_redirect, AppConstants.SERVER_URL);
Expand Down
9 changes: 2 additions & 7 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1444,15 +1444,10 @@ async function handleRemovalFormSignup(req, res) {

if (user.kid) {
console.error(
"user should have been directed to the handleRemovalAcctUpdate function if they have a kid"
);
const localeError = LocaleUtils.formatRemoveString(
"remove-error-account-exists"
"user should not be able to submit the form again if they already have a Kanary ID"
);

return res.status(400).json({
error: localeError,
});
return res.redirect("/user/remove-data");
}

const {
Expand Down
2 changes: 1 addition & 1 deletion db/DB.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ const DB = {
kid: null,
removal_would_pay: null,
removal_enrolled_time: null,
removal_optout: true,
removal_optout: false, //MH TODO: reenable after debugging stage
})
.catch((e) => {
console.error("error removing kanary id", e);
Expand Down
2 changes: 1 addition & 1 deletion form-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const FormUtils = {
return parseFloat(mode);
},
canShowViaParams(doShow) {
return ["dev", "heroku"].includes(AppConstants.NODE_ENV) && doShow;
return ["dev", "heroku", "stage"].includes(AppConstants.NODE_ENV) && doShow;
},
};

Expand Down

0 comments on commit 9418a57

Please sign in to comment.