Server: Dismiss admin password notification when password has been changed

This commit is contained in:
Laurent Cozic committed 2021-01-12 16:02:44 +00:00
1 parent 5aa5089ae0
commit fb5eb1a47b
2 files changed
+5

No files matched your search

@@ -27,6 +27,8 @@ export default async function(ctx: AppContext, next: KoaNext): Promise<void> {
NotificationLevel.Important,
_('The default admin password is insecure and has not been changed! [Change it now](%s)', await ctx.models.user().profileUrl())
);
} else {
await notificationModel.markAsRead('change_admin_password');
}
}
@@ -14,6 +14,9 @@ export default class NotificationModel extends BaseModel {
}
public async markAsRead(key: string): Promise<void> {
const n = await this.loadByKey(key);
if (!n) return;
await this.db(this.tableName)
.update({ read: 1 })
.where('key', '=', key)