Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Chatterbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
element-hq
Chatterbox
Commits
c265fbe8
Commit
c265fbe8
authored
3 years ago
by
RMidhunSuresh
Browse files
Options
Downloads
Patches
Plain Diff
Use username from registration response
parent
2f5903e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/viewmodels/AccountSetupViewModel.ts
+5
-5
5 additions, 5 deletions
src/viewmodels/AccountSetupViewModel.ts
with
5 additions
and
5 deletions
src/viewmodels/AccountSetupViewModel.ts
+
5
−
5
View file @
c265fbe8
...
...
@@ -9,7 +9,6 @@ export class AccountSetupViewModel extends ViewModel {
private
_client
:
typeof
Client
;
private
_startStage
?:
any
;
private
_password
:
string
;
private
_username
:
string
;
private
_registration
:
any
;
private
_privacyPolicyLink
:
string
;
...
...
@@ -25,8 +24,8 @@ export class AccountSetupViewModel extends ViewModel {
const
maxAttempts
=
10
;
for
(
let
i
=
0
;
i
<
maxAttempts
;
++
i
)
{
try
{
this
.
_
username
=
`
${
this
.
_config
.
username_prefix
}
-
${
generateUsername
(
10
)}
`
;
this
.
_registration
=
await
this
.
_client
.
startRegistration
(
this
.
_homeserver
,
this
.
_
username
,
this
.
_password
,
"
Chatterbox
"
);
const
username
=
`
${
this
.
_config
.
username_prefix
}
-
${
generateUsername
(
10
)}
`
;
this
.
_registration
=
await
this
.
_client
.
startRegistration
(
this
.
_homeserver
,
username
,
this
.
_password
,
"
Chatterbox
"
);
this
.
_startStage
=
await
this
.
_registration
.
start
();
let
stage
=
this
.
_startStage
;
while
(
stage
.
type
!==
"
m.login.terms
"
)
{
...
...
@@ -58,12 +57,13 @@ export class AccountSetupViewModel extends ViewModel {
}
stage
=
await
this
.
_registration
.
submitStage
(
stage
);
}
const
loginPromise
=
this
.
login
(
this
.
_username
,
this
.
_password
);
const
loginPromise
=
this
.
login
(
this
.
_password
);
this
.
navigation
.
push
(
"
timeline
"
,
loginPromise
);
}
async
login
(
username
:
string
,
password
:
string
):
Promise
<
void
>
{
async
login
(
password
:
string
):
Promise
<
void
>
{
const
loginOptions
=
await
this
.
_client
.
queryLogin
(
this
.
_homeserver
).
result
;
const
username
=
this
.
_registration
.
sessionInfo
.
user_id
;
this
.
_client
.
startWithLogin
(
loginOptions
.
password
(
username
,
password
));
await
this
.
_client
.
loadStatus
.
waitFor
((
status
:
string
)
=>
{
return
status
===
LoadStatus
.
Ready
||
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment