mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Add startRegistration method
This commit is contained in:
parent
8ab8726b8f
commit
170d7a5e55
@ -30,6 +30,7 @@ import {PasswordLoginMethod} from "./login/PasswordLoginMethod";
|
||||
import {TokenLoginMethod} from "./login/TokenLoginMethod";
|
||||
import {SSOLoginHelper} from "./login/SSOLoginHelper";
|
||||
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
|
||||
import {Registration} from "./registration/Registration";
|
||||
|
||||
export const LoadStatus = createEnum(
|
||||
"NotLoading",
|
||||
@ -131,6 +132,19 @@ export class Client {
|
||||
});
|
||||
}
|
||||
|
||||
async startRegistration(homeserver, username, password, initialDeviceDisplayName) {
|
||||
const request = this._platform.request;
|
||||
const hsApi = new HomeServerApi({homeserver, request});
|
||||
const registration = new Registration(hsApi, {
|
||||
username,
|
||||
password,
|
||||
initialDeviceDisplayName,
|
||||
inhibitLogin: true
|
||||
});
|
||||
let stage = await registration.start();
|
||||
return stage;
|
||||
}
|
||||
|
||||
async startWithLogin(loginMethod, {inspectAccountSetup} = {}) {
|
||||
const currentStatus = this._status.get();
|
||||
if (currentStatus !== LoadStatus.LoginFailed &&
|
||||
|
Loading…
Reference in New Issue
Block a user