2022-06-24 02:38:55 +02:00
|
|
|
import { Utils } from "@bitwarden/common/misc/utils";
|
|
|
|
|
2018-07-27 22:44:20 +02:00
|
|
|
import { Password } from "../domain/password";
|
|
|
|
|
2022-02-22 15:39:11 +01:00
|
|
|
import { View } from "./view";
|
|
|
|
|
2018-07-27 22:44:20 +02:00
|
|
|
export class PasswordHistoryView implements View {
|
2019-01-25 15:30:21 +01:00
|
|
|
password: string = null;
|
|
|
|
lastUsedDate: Date = null;
|
2018-07-27 22:44:20 +02:00
|
|
|
|
|
|
|
constructor(ph?: Password) {
|
|
|
|
if (!ph) {
|
|
|
|
return;
|
|
|
|
}
|
2021-12-16 13:36:21 +01:00
|
|
|
|
2018-07-27 22:44:20 +02:00
|
|
|
this.lastUsedDate = ph.lastUsedDate;
|
2021-12-16 13:36:21 +01:00
|
|
|
}
|
2022-06-24 02:38:55 +02:00
|
|
|
|
2022-06-24 04:36:43 +02:00
|
|
|
static fromJSON(obj: any): PasswordHistoryView {
|
2022-06-28 00:17:42 +02:00
|
|
|
return Utils.copyToNewObject(
|
|
|
|
obj,
|
|
|
|
{
|
|
|
|
password: null,
|
|
|
|
lastUsedDate: null,
|
|
|
|
},
|
|
|
|
PasswordHistoryView
|
|
|
|
);
|
2022-06-24 02:38:55 +02:00
|
|
|
}
|
2018-07-27 22:44:20 +02:00
|
|
|
}
|