Skip to content

Commit

Permalink
Merge branch 'main' into snyk-upgrade-55e69c54c9c39d7d899989cefd7e2b1a
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Oct 9, 2024
2 parents de3f0eb + b7a56bf commit c3c2758
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 25 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changelog
-------------------

* Stricter validation on the 'Create App Client Form.'
* Looks for database in 'public' searchPath in Postgres. (@Zen-cronic)
* Fix internal error on user/id route in Postgres. (@Zen-cronic)


0.26.2 (2024-08-30)
Expand Down
36 changes: 21 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"eff-diceware-passphrase": "^3.0.0",
"geoip-lite": "^1.0.10",
"handlebars": "^4.7.7",
"jose": "^5.1.0",
"jose": "^5.9.2",
"knex": "^3.0.1",
"mysql2": "^3.10.2",
"mysql2": "^3.11.2",
"nodemailer": "^6.9.15",
"otplib": "^12.0.1",
"pg": "^8.7.1",
Expand Down
4 changes: 2 additions & 2 deletions src/changepassword/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class ChangePasswordController extends Controller {

async get(ctx: Context) {

const csrfToken = await ctx.getCsrf();
ctx.response.type = 'text/html';
ctx.response.body = changePasswordForm(ctx.query.msg, ctx.query.error);

ctx.response.body = changePasswordForm(ctx.query.msg, ctx.query.error, csrfToken);
}

async post(ctx: Context<any>) {
Expand Down
3 changes: 2 additions & 1 deletion src/changepassword/formats/html.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { render } from '../../templates.js';

export function changePasswordForm(msg: string, error: string) {
export function changePasswordForm(msg: string, error: string, csrfToken: string) {

return render('changepassword', {
title: 'Change Password',
msg: msg,
error: error,
action: '/change-password',
csrfToken: csrfToken,
});

}
1 change: 1 addition & 0 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export function getSettings(): Knex.Config {
searchPath = [
connection.user as string,
connection.database as string,
'public',
];
break;
case 'mysql' :
Expand Down
6 changes: 3 additions & 3 deletions src/principal-identity/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ function recordToModel(principal: Principal, record: PrincipalIdentitiesRecord):
externalId: record.external_id,
label: record.label,
isPrimary: !!record.is_primary,
verifiedAt: record.verified_at ? new Date(record.verified_at) : null,
createdAt: new Date(record.created_at),
modifiedAt: new Date(record.modified_at),
verifiedAt: record.verified_at ? new Date(+record.verified_at) : null,
createdAt: new Date(+record.created_at),
modifiedAt: new Date(+record.modified_at),
};

}
4 changes: 2 additions & 2 deletions src/principal/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ function recordToModel(user: PrincipalsRecord): Principal {
href: `/${userTypeIntToUserType(user.type)}/${user.external_id}`,
externalId: user.external_id,
nickname: user.nickname!,
createdAt: new Date(user.created_at),
modifiedAt: new Date(user.modified_at),
createdAt: new Date(+user.created_at),
modifiedAt: new Date(+user.modified_at),
type: userTypeIntToUserType(user.type),
active: !!user.active,
system: !!user.system,
Expand Down
2 changes: 2 additions & 0 deletions templates/changepassword.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<p class="form-options"><a href="/">Cancel</a></p>
</fieldset>

<input type="hidden" name="csrf-token" value="{{ csrfToken }}" />

{{#each hiddenFields}}
<input type="hidden" name="{{@key}}" value="{{this}}" />
{{/each}}
Expand Down

0 comments on commit c3c2758

Please sign in to comment.