upgrade to newest backend
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class Auth2FAService {
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
|
||||
getEnabled() {
|
||||
return this.http.get(environment.apiUrl + "/auth/2fa");
|
||||
}
|
||||
|
||||
getAvailable() {
|
||||
return this.http.get(environment.apiUrl + "/auth/2fa/available");
|
||||
}
|
||||
|
||||
isEnabled(provider) {
|
||||
return this.http.get(environment.apiUrl + "/auth/2fa/" + provider);
|
||||
}
|
||||
|
||||
create(provider) {
|
||||
return this.http.put(environment.apiUrl + "/auth/2fa/" + provider, {});
|
||||
}
|
||||
|
||||
enable(provider, code) {
|
||||
return this.http.patch(environment.apiUrl + "/auth/2fa/" + provider, code);
|
||||
}
|
||||
|
||||
remove(provider) {
|
||||
return this.http.delete(environment.apiUrl + "/auth/2fa/" + provider);
|
||||
}
|
||||
|
||||
login(provider, code, keep) {
|
||||
return this.http.post(environment.apiUrl + "/auth/login/2fa", {
|
||||
'provider': provider,
|
||||
'code': code,
|
||||
'keep': keep
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, of } from 'rxjs';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ReplaySubject, of} from 'rxjs';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
|
||||
import { environment } from './../../environments/environment';
|
||||
import {environment} from './../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AuthService {
|
||||
|
||||
auth: BehaviorSubject<any> = new BehaviorSubject(undefined);
|
||||
auth: ReplaySubject<any> = new ReplaySubject(undefined);
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
@@ -37,31 +37,11 @@ export class AuthService {
|
||||
|
||||
passwordRequest(username) {
|
||||
const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
|
||||
return this.http.post(environment.apiUrl + "/auth/password/request", username, { headers, responseType: 'text' });
|
||||
return this.http.post(environment.apiUrl + "/auth/password/request", username, {headers, responseType: 'text'});
|
||||
}
|
||||
|
||||
passwordReset(model) {
|
||||
const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
|
||||
return this.http.post(environment.apiUrl + "/auth/password/reset", model);
|
||||
}
|
||||
|
||||
isTotpEnabled() {
|
||||
return this.http.get(environment.apiUrl + "/auth/totp");
|
||||
}
|
||||
|
||||
createTotp() {
|
||||
return this.http.put(environment.apiUrl + "/auth/totp", {});
|
||||
}
|
||||
|
||||
enableTotp(code) {
|
||||
return this.http.patch(environment.apiUrl + "/auth/totp", code);
|
||||
}
|
||||
|
||||
removeTotp() {
|
||||
return this.http.delete(environment.apiUrl + "/auth/totp");
|
||||
}
|
||||
|
||||
loginTotp(totpModel) {
|
||||
return this.http.post(environment.apiUrl + "/auth/login/totp", totpModel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user