Skip to content

Commit

Permalink
fix: indentation problems (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniloch authored and Daniloch committed May 31, 2024
1 parent 5cc274d commit 7901b6e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
48 changes: 24 additions & 24 deletions src/routes/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,37 +152,37 @@ router.get('/logout', async (_request, response) => {
});

router.get('/forgot-password', async (request, response) => {
const renderData = {
input: request.cookies.input,
success_message: request.cookies.success_message,
error_message: request.cookies.error_message,
}

response.clearCookie('input', { domain: '.pretendo.network' });
const renderData = {
input: request.cookies.input,
success_message: request.cookies.success_message,
error_message: request.cookies.error_message,
}
response.clearCookie('input', { domain: '.pretendo.network' });

response.render('account/forgot-password', renderData);
});

router.post('/forgot-password', async (request, response) => {
const { input, 'h-captcha-response': hCaptchaResponse } = request.body;

response.cookie('input', input, { domain: '.pretendo.network' });

try {
await util.forgotPassword({
input,
hCaptchaResponse
})
const { input, 'h-captcha-response': hCaptchaResponse } = request.body;

response.clearCookie('input', { domain: '.pretendo.network' });
response.cookie('input', input, { domain: '.pretendo.network' });

response.cookie('success_message', 'An email has been sent.', { domain: '.pretendo.network' });

response.redirect(request.redirect || '/account/forgot-password');
} catch (error) {
response.cookie('error_message', error.message, { domain: '.pretendo.network' });
return response.redirect('/account/forgot-password');
}
try {
await util.forgotPassword({
input,
hCaptchaResponse
})

response.clearCookie('input', { domain: '.pretendo.network' });

response.cookie('success_message', 'An email has been sent.', { domain: '.pretendo.network' });

response.redirect(request.redirect || '/account/forgot-password');
} catch (error) {
response.cookie('error_message', error.message, { domain: '.pretendo.network' });
return response.redirect('/account/forgot-password');
}
});

router.get('/reset-password', async (request, response) => {
Expand Down
54 changes: 27 additions & 27 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ async function login(username, password) {
}

async function forgotPassword(forgotPasswordData) {
const apiResponse = await apiPostRequest('/v1/forgot-password', {}, forgotPasswordData);

if (apiResponse.statusCode !== 200) {
throw new Error(apiResponse.body.error);
}

return apiResponse.body;
const apiResponse = await apiPostRequest('/v1/forgot-password', {}, forgotPasswordData);
if (apiResponse.statusCode !== 200) {
throw new Error(apiResponse.body.error);
}
return apiResponse.body;
}

async function refreshLogin(request, response) {
Expand Down Expand Up @@ -262,24 +262,24 @@ function signDiscoursePayload(payload) {
}

module.exports = {
fullUrl,
getLocale,
getRawDocs,
parseDocs,
apiGetRequest,
apiPostRequest,
apiDeleteRequest,
register,
login,
forgotPassword,
refreshLogin,
getUserAccountData,
updateDiscordConnection,
removeDiscordConnection,
nintendoPasswordHash,
assignDiscordMemberSupporterRole,
assignDiscordMemberTesterRole,
removeDiscordMemberSupporterRole,
removeDiscordMemberTesterRole,
signDiscoursePayload
fullUrl,
getLocale,
getRawDocs,
parseDocs,
apiGetRequest,
apiPostRequest,
apiDeleteRequest,
register,
login,
forgotPassword,
refreshLogin,
getUserAccountData,
updateDiscordConnection,
removeDiscordConnection,
nintendoPasswordHash,
assignDiscordMemberSupporterRole,
assignDiscordMemberTesterRole,
removeDiscordMemberSupporterRole,
removeDiscordMemberTesterRole,
signDiscoursePayload
};

0 comments on commit 7901b6e

Please sign in to comment.