Skip to content

Commit

Permalink
fix: indentation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniloch authored and Daniloch committed Jun 2, 2024
1 parent 7901b6e commit de56848
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions src/routes/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ 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,
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);
Expand All @@ -169,19 +169,19 @@ router.post('/forgot-password', async (request, response) => {
response.cookie('input', input, { domain: '.pretendo.network' });

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');
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');
response.cookie('error_message', error.message, { domain: '.pretendo.network' });
return response.redirect('/account/forgot-password');
}
});

Expand Down
6 changes: 3 additions & 3 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ 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);
throw new Error(apiResponse.body.error);
}

return apiResponse.body;
}

Expand Down
2 changes: 1 addition & 1 deletion views/account/forgot-password.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<label for="input">{{ locale.account.forgotPassword.input }}</label>
<input name="input" id="input" value="{{ input }}" required>
</div>
<div class="h-captcha" data-sitekey="cf3fd74e-93ca-47e6-9fa0-5fc439de06d4"></div>
<div class="h-captcha" data-sitekey="cf3fd74e-93ca-47e6-9fa0-5fc439de06d4"></div>
<div class="buttons">
<button type="submit">{{ locale.account.forgotPassword.submit }}</button>
</div>
Expand Down

0 comments on commit de56848

Please sign in to comment.