#9 - show app password use date in profile
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is failing

This commit is contained in:
2021-12-14 16:40:15 -06:00
parent fd8a05446a
commit cf91063315
6 changed files with 14 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ class AppPasswordModel extends Model {
return {
hash: String,
created: { type: Date, default: () => new Date },
accessed: Date,
expires: Date,
active: { type: Boolean, default: true },
name: String,

View File

@@ -160,7 +160,11 @@ class User extends AuthUser {
async check_app_password(password) {
for ( const pw of this.app_passwords ) {
if ( await pw.verify(password) ) return true
if ( await pw.verify(password) ) {
pw.accessed = new Date
await pw.save()
return true
}
}
return false