Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login: restrict archived users (fixes #7380) #7382

Merged
merged 5 commits into from
Dec 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Restrict archived users from logging in
  • Loading branch information
Mutugiii committed Dec 19, 2023
commit 544f927b567c4fe9a5cdaf0dee9c54dd3576ae81
13 changes: 13 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,22 @@ 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) {
console.log(userData);
this.errorHandler($localize`Member ${name} is archived`)();
}
});
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
Loading