mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Create LoginMethod for password login
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
e0fcec9102
commit
20765d9688
10
src/matrix/LoginMethod.js
Normal file
10
src/matrix/LoginMethod.js
Normal file
@ -0,0 +1,10 @@
|
||||
export class LoginMethod {
|
||||
constructor({homeServer, platform}) {
|
||||
this.homeServer = homeServer;
|
||||
this._platform = platform;
|
||||
}
|
||||
|
||||
async login(hsApi, deviceName) {
|
||||
throw("Not Implemented");
|
||||
}
|
||||
}
|
15
src/matrix/PasswordLoginMethod.js
Normal file
15
src/matrix/PasswordLoginMethod.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { LoginMethod } from "./LoginMethod.js";
|
||||
|
||||
export class PasswordLoginMethod extends LoginMethod {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.username = options.username;
|
||||
this.password = options.password;
|
||||
}
|
||||
|
||||
async login(hsApi, deviceName) {
|
||||
return this._platform.logger.run("passwordLogin", async log =>
|
||||
await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response()
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user