#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">
|
||||
{{ pw.name }}
|
||||
<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 class="col-3 my-auto">
|
||||
<button
|
||||
@ -288,7 +289,9 @@ export default class EditProfileComponent extends Component {
|
||||
'profile.save_notify',
|
||||
'profile.test_notify',
|
||||
'profile.advanced_header',
|
||||
'profile.advanced_shell'
|
||||
'profile.advanced_shell',
|
||||
'profile.accessed',
|
||||
'common.never'
|
||||
)
|
||||
|
||||
this.app_name = session.get('app.name')
|
||||
@ -403,6 +406,7 @@ export default class EditProfileComponent extends Component {
|
||||
this.app_passwords = app_pws.map(x => {
|
||||
if ( x.expires ) x.expires = (new Date(x.expires)).toLocaleDateString()
|
||||
if ( x.created ) x.created = (new Date(x.created)).toLocaleDateString()
|
||||
if ( x.accessed ) x.accessed = (new Date(x.accessed)).toLocaleDateString()
|
||||
return x
|
||||
})
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ class PasswordController extends Controller {
|
||||
return {
|
||||
created: x.created,
|
||||
expires: x.expires,
|
||||
accessed: x.accessed,
|
||||
active: x.active,
|
||||
name: x.name ?? req.T('common.unnamed'),
|
||||
uuid: x.uuid,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -7,6 +7,7 @@ module.exports = exports = {
|
||||
|
||||
invalid: 'Invalid',
|
||||
unnamed: '(unnamed)',
|
||||
never: 'Never',
|
||||
|
||||
yes: 'Yes',
|
||||
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.',
|
||||
|
||||
issued: 'Issued:',
|
||||
accessed: 'Last Used:',
|
||||
gen_new: 'Generate New',
|
||||
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.',
|
||||
|
Loading…
Reference in New Issue
Block a user