Skip to content

Commit d087081

Browse files
committed
Merge remote-tracking branch 'origin/bugfix/10.5.17/Unable-to-change-status-to-complete-if-observations-contain-french-characters' into bugfix/10.5.17/Unable-to-change-status-to-complete-if-observations-contain-french-characters
2 parents 8c9bd33 + 3d31e33 commit d087081

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
## Bugfix
33
-Fixed unable-to-change-status-to-complete-if-observations-contain-french-characters.
44
-Fixed Elastic filter time adds unnecessary /d to intervals in Log Explorer
5+
-Fixed handle special characters in password query parameter
6+

frontend/src/app/core/auth/user-route-access-service.ts

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {StateStorageService} from './state-storage.service';
99
export class UserRouteAccessService implements CanActivate {
1010
constructor(
1111
private router: Router,
12-
private loginModalService: ModalService,
1312
private accountService: AccountService,
1413
private stateStorageService: StateStorageService
1514
) {
@@ -23,30 +22,23 @@ export class UserRouteAccessService implements CanActivate {
2322
return this.checkLogin(authorities, state.url);
2423
}
2524

26-
checkLogin(authorities: string[], url: string): Promise<boolean> {
27-
return this.accountService.identity().then(account => {
28-
if (!authorities || authorities.length === 0) {
29-
return false;
25+
async checkLogin(authorities: string[], url: string): Promise<boolean> {
26+
const account = await this.accountService.identity();
27+
if (!authorities || authorities.length === 0) {
28+
return false;
29+
}
30+
if (account) {
31+
const hasAnyAuthority = this.accountService.hasAnyAuthority(authorities);
32+
if (hasAnyAuthority) {
33+
return true;
3034
}
31-
if (account) {
32-
const hasAnyAuthority = this.accountService.hasAnyAuthority(authorities);
33-
if (hasAnyAuthority) {
34-
return true;
35-
}
36-
if (isDevMode()) {
37-
console.error('User has not any of required authorities: ', authorities);
38-
}
39-
return false;
35+
if (isDevMode()) {
36+
console.error('User has not any of required authorities: ', authorities);
4037
}
41-
38+
return false;
39+
} else {
4240
this.stateStorageService.storeUrl(url);
43-
this.router.navigate(['/dashboard/overview']).then(() => {
44-
// only show the login dialog, if the user hasn't logged in yet
45-
if (!account) {
46-
// this.loginModalService.open();
47-
}
48-
});
4941
return false;
50-
});
42+
}
5143
}
5244
}

frontend/src/app/shared/components/auth/login/login.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AfterViewInit, Component, OnInit} from '@angular/core';
1+
import {Component, OnInit} from '@angular/core';
22
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
33
import {DomSanitizer} from '@angular/platform-browser';
44
import {ActivatedRoute, Router} from '@angular/router';
@@ -14,6 +14,7 @@ import {ThemeChangeBehavior} from '../../../behaviors/theme-change.behavior';
1414
import {ADMIN_DEFAULT_EMAIL, ADMIN_ROLE, DEMO_URL, USER_ROLE} from '../../../constants/global.constant';
1515
import {stringParamToQueryParams} from '../../../util/query-params-to-filter.util';
1616
import {PasswordResetInitComponent} from '../password-reset/init/password-reset-init.component';
17+
import {StateStorageService} from "../../../../core/auth/state-storage.service";
1718

1819
@Component({
1920
selector: 'app-login',
@@ -48,7 +49,8 @@ export class LoginComponent implements OnInit {
4849
private modalService: NgbModal,
4950
private themeChangeBehavior: ThemeChangeBehavior,
5051
private spinner: NgxSpinnerService,
51-
private apiServiceCheckerService: ApiServiceCheckerService
52+
private apiServiceCheckerService: ApiServiceCheckerService,
53+
private stateStorageService: StateStorageService
5254
) {
5355
this.credentials = {};
5456
this.isInDemo = window.location.href.includes(DEMO_URL);
@@ -166,8 +168,9 @@ export class LoginComponent implements OnInit {
166168
startNavigation() {
167169
this.accountService.identity(true).then(account => {
168170
if (account) {
171+
const url = this.stateStorageService.getUrl();
169172
const redirectTo = (account.authorities.includes(ADMIN_ROLE) && account.email === ADMIN_DEFAULT_EMAIL)
170-
? '/getting-started' : '/dashboard/overview';
173+
? '/getting-started' : !!url ? url : '/dashboard/overview';
171174
this.router.navigate([redirectTo])
172175
.then(() => this.spinner.hide());
173176
} else {

frontend/src/app/shared/components/utm/util/utm-agent-console/utm-agent-console.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ export class UtmAgentConsoleComponent implements OnInit, OnDestroy {
198198

199199
checkPassword() {
200200
const uuid = UUID.UUID();
201-
this.accountService.checkPassword(this.pass, uuid).subscribe(response => {
201+
const encodedPassword = encodeURIComponent(this.pass);
202+
const encodedUUID = encodeURIComponent(uuid);
203+
this.accountService.checkPassword(encodedPassword, encodedUUID).subscribe(response => {
202204
if (response.body !== uuid) {
203205
this.toast.showError('Invalid check UUID', 'UUID to check your password does not match');
204206
} else {

0 commit comments

Comments
 (0)