mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-4767] encode-decode.util.ts removed
This commit is contained in:
@@ -42,7 +42,6 @@ import {
|
|||||||
UnsetUserAsIdleAction
|
UnsetUserAsIdleAction
|
||||||
} from './auth.actions';
|
} from './auth.actions';
|
||||||
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
|
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
|
||||||
import { loginEncodeUrl } from '../../shared/utils/encode-decode.util';
|
|
||||||
import { RouteService } from '../services/route.service';
|
import { RouteService } from '../services/route.service';
|
||||||
import { EPersonDataService } from '../eperson/eperson-data.service';
|
import { EPersonDataService } from '../eperson/eperson-data.service';
|
||||||
import { getAllSucceededRemoteDataPayload } from '../shared/operators';
|
import { getAllSucceededRemoteDataPayload } from '../shared/operators';
|
||||||
@@ -103,7 +102,7 @@ export class AuthService {
|
|||||||
*/
|
*/
|
||||||
public authenticate(user: string, password: string): Observable<AuthStatus> {
|
public authenticate(user: string, password: string): Observable<AuthStatus> {
|
||||||
// Attempt authenticating the user using the supplied credentials.
|
// Attempt authenticating the user using the supplied credentials.
|
||||||
const body = (`password=${loginEncodeUrl(password)}&user=${loginEncodeUrl(user)}`);
|
const body = (`password=${encodeURIComponent(password)}&user=${encodeURIComponent(user)}`);
|
||||||
const options: HttpOptions = Object.create({});
|
const options: HttpOptions = Object.create({});
|
||||||
let headers = new HttpHeaders();
|
let headers = new HttpHeaders();
|
||||||
headers = headers.append('Content-Type', 'application/x-www-form-urlencoded');
|
headers = headers.append('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
import { loginEncodeUrl } from './encode-decode.util';
|
|
||||||
|
|
||||||
describe('Encode/Decode Utils', () => {
|
|
||||||
const strng = '+string+/=t-%';
|
|
||||||
const encodedStrng = '%2Bstring%2B%2F%3Dt-%25';
|
|
||||||
|
|
||||||
it('should return encoded string', () => {
|
|
||||||
expect(loginEncodeUrl(strng)).toBe(encodedStrng);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* use this to make a Base64 encoded string URL friendly,
|
|
||||||
* i.e. '+' and '/' are replaced with special percent-encoded hexadecimal sequences
|
|
||||||
*
|
|
||||||
* @param {String} str the encoded string
|
|
||||||
* @returns {String} the URL friendly encoded String
|
|
||||||
*/
|
|
||||||
export function loginEncodeUrl(str): string {
|
|
||||||
return encodeURIComponent(str);
|
|
||||||
}
|
|
Reference in New Issue
Block a user