summaryrefslogtreecommitdiff
path: root/ui/app/models/dummy_account.js
blob: 99fb66239fc82c4bb52edc5a7e53633147f66f00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// A proxy of an account, but with a different ID. For testing.
//

import bitmask from 'lib/bitmask'

export default class DummyAccount {

  constructor(account) {
    this.account = account
  }

  get id() {
    return 'dummy--' + this.account.address
  }

  get domain() {return this.account.domain}
  get address() {return this.account.address}
  get userpart() {return this.account.userpart}
  get authenticated() {return this.account.authenticated}
  get hasEmail() {return this.account.hasEmail}
  login(password) {return this.account.login(password)}

  logout() {
    return bitmask.bonafide.user.logout(this.address).then(
      response => {
        this._authenticated = false
        this._address = '@' + this.domain
        return this
      }
    )
  }
}