#9 - show app password use date in profile
This commit is contained in:
parent
fd8a05446a
commit
cf91063315
@ -131,6 +131,7 @@ const template = `
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
{{ pw.name }}
|
{{ pw.name }}
|
||||||
<br><span class="text-muted font-italic">{{ t['profile.issued'] }} {{ pw.created }}</span>
|
<br><span class="text-muted font-italic">{{ t['profile.issued'] }} {{ pw.created }}</span>
|
||||||
|
<span class="text-muted font-italic"> | {{ t['profile.accessed'] }} {{ pw.accessed || t['common.never'] }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 my-auto">
|
<div class="col-3 my-auto">
|
||||||
<button
|
<button
|
||||||
@ -288,7 +289,9 @@ export default class EditProfileComponent extends Component {
|
|||||||
'profile.save_notify',
|
'profile.save_notify',
|
||||||
'profile.test_notify',
|
'profile.test_notify',
|
||||||
'profile.advanced_header',
|
'profile.advanced_header',
|
||||||
'profile.advanced_shell'
|
'profile.advanced_shell',
|
||||||
|
'profile.accessed',
|
||||||
|
'common.never'
|
||||||
)
|
)
|
||||||
|
|
||||||
this.app_name = session.get('app.name')
|
this.app_name = session.get('app.name')
|
||||||
@ -403,6 +406,7 @@ export default class EditProfileComponent extends Component {
|
|||||||
this.app_passwords = app_pws.map(x => {
|
this.app_passwords = app_pws.map(x => {
|
||||||
if ( x.expires ) x.expires = (new Date(x.expires)).toLocaleDateString()
|
if ( x.expires ) x.expires = (new Date(x.expires)).toLocaleDateString()
|
||||||
if ( x.created ) x.created = (new Date(x.created)).toLocaleDateString()
|
if ( x.created ) x.created = (new Date(x.created)).toLocaleDateString()
|
||||||
|
if ( x.accessed ) x.accessed = (new Date(x.accessed)).toLocaleDateString()
|
||||||
return x
|
return x
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ class PasswordController extends Controller {
|
|||||||
return {
|
return {
|
||||||
created: x.created,
|
created: x.created,
|
||||||
expires: x.expires,
|
expires: x.expires,
|
||||||
|
accessed: x.accessed,
|
||||||
active: x.active,
|
active: x.active,
|
||||||
name: x.name ?? req.T('common.unnamed'),
|
name: x.name ?? req.T('common.unnamed'),
|
||||||
uuid: x.uuid,
|
uuid: x.uuid,
|
||||||
|
@ -7,6 +7,7 @@ class AppPasswordModel extends Model {
|
|||||||
return {
|
return {
|
||||||
hash: String,
|
hash: String,
|
||||||
created: { type: Date, default: () => new Date },
|
created: { type: Date, default: () => new Date },
|
||||||
|
accessed: Date,
|
||||||
expires: Date,
|
expires: Date,
|
||||||
active: { type: Boolean, default: true },
|
active: { type: Boolean, default: true },
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -160,7 +160,11 @@ class User extends AuthUser {
|
|||||||
|
|
||||||
async check_app_password(password) {
|
async check_app_password(password) {
|
||||||
for ( const pw of this.app_passwords ) {
|
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
|
return false
|
||||||
|
@ -7,6 +7,7 @@ module.exports = exports = {
|
|||||||
|
|
||||||
invalid: 'Invalid',
|
invalid: 'Invalid',
|
||||||
unnamed: '(unnamed)',
|
unnamed: '(unnamed)',
|
||||||
|
never: 'Never',
|
||||||
|
|
||||||
yes: 'Yes',
|
yes: 'Yes',
|
||||||
no: 'No',
|
no: 'No',
|
||||||
|
@ -37,6 +37,7 @@ module.exports = exports = {
|
|||||||
test_notification: 'This is a test notification! If you see this, it means you have properly configured your notification settings.',
|
test_notification: 'This is a test notification! If you see this, it means you have properly configured your notification settings.',
|
||||||
|
|
||||||
issued: 'Issued:',
|
issued: 'Issued:',
|
||||||
|
accessed: 'Last Used:',
|
||||||
gen_new: 'Generate New',
|
gen_new: 'Generate New',
|
||||||
recovery_codes: 'Recovery Codes',
|
recovery_codes: 'Recovery Codes',
|
||||||
recovery_1: 'Recovery codes can be used to regain access to your account in the event that you lose access to the device that generates your MFA codes.',
|
recovery_1: 'Recovery codes can be used to regain access to your account in the event that you lose access to the device that generates your MFA codes.',
|
||||||
|
Loading…
Reference in New Issue
Block a user