Fix password login

This commit is contained in:
RMidhunSuresh 2021-11-24 14:00:26 +05:30
parent 64037cb32a
commit a1367f8e72
2 changed files with 8 additions and 8 deletions

View file

@ -26,7 +26,7 @@ import {MediaRepository} from "./net/MediaRepository.js";
import {RequestScheduler} from "./net/RequestScheduler.js";
import {Sync, SyncStatus} from "./Sync.js";
import {Session} from "./Session.js";
import {PasswordLoginMethod} from "./login/PasswordLoginMethod.js";
import {PasswordLoginMethod} from "./login/PasswordLoginMethod";
import {TokenLoginMethod} from "./login/TokenLoginMethod";
import {SSOLoginHelper} from "./login/SSOLoginHelper.js";
import {getDehydratedDevice} from "./e2ee/Dehydration.js";

View file

@ -19,17 +19,17 @@ import {ILoginMethod} from "./LoginMethod";
import {HomeServerApi} from "../net/HomeServerApi.js";
export class PasswordLoginMethod implements ILoginMethod {
public username: string;
public password: string;
public homeserver: string;
private readonly _username: string;
private readonly _password: string;
public readonly homeserver: string;
constructor({username, password, homeserver}: {username: string, password: string, homeserver: string}) {
this.username = username;
this.password = password;
this._username = username;
this._password = password;
this.homeserver = homeserver;
}
async login(hsApi: HomeServerApi, deviceName: string, log: ILogItem) {
return await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response();
async login(hsApi: HomeServerApi, deviceName: string, log: ILogItem): Promise<Response["body"]> {
return await hsApi.passwordLogin(this._username, this._password, deviceName, {log}).response();
}
}