Skip to content

Commit

Permalink
login: restrict archived users (fixes #7380) (#7382)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Mutugiii and dogi committed Dec 27, 2023
1 parent 3698bbf commit efd5d6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.14.0",
"version": "0.14.1",
"myplanet": {
"latest": "v0.12.37",
"latest": "v0.12.41",
"min": "v0.11.60"
},
"scripts": {
Expand Down
12 changes: 12 additions & 0 deletions src/app/login/login-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,21 @@ export class LoginFormComponent {
{ withCredentials: true, domain: this.stateService.configuration.parentDomain });
}

checkArchiveStatus(name) {
this.couchService.get('_users/org.couchdb.user:' + name).subscribe((userData) => {
if (userData?.isArchived) {
this.errorHandler($localize`Member ${name} is not registered`)();
}
});
return true;
}

login({ name, password }: { name: string, password: string }, isCreate: boolean) {
const configuration = this.stateService.configuration;
const userId = `org.couchdb.user:${name}`;
if (this.checkArchiveStatus(name)) {
return;
}
this.pouchAuthService.login(name, password).pipe(
switchMap(() => isCreate ? from(this.router.navigate([ 'users/update/' + name ])) : from(this.reRoute())),
switchMap(() => forkJoin(this.pouchService.replicateFromRemoteDBs())),
Expand Down

0 comments on commit efd5d6c

Please sign in to comment.