This commit is contained in:
Lurkars
2021-01-12 19:29:00 +01:00
parent b7b4e2d032
commit 997a512e00
96 changed files with 2711 additions and 304 deletions
+25 -6
View File
@@ -27,22 +27,41 @@ export class AuthService {
return this.http.get(environment.apiUrl + "/auth/me");
}
login(username, password) {
return this.http.post(environment.apiUrl + "/auth/login", { username: username, password: password });
login(loginModel) {
return this.http.post(environment.apiUrl + "/auth/login", loginModel);
}
logout() {
return this.http.post(environment.apiUrl + "/auth/logout", {});
}
passwordRequest() {
return this.http.post(environment.apiUrl + "/auth/password/request", {});
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' });
}
passwordReset(model) {
const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
return this.http.post(environment.apiUrl + "/auth/password/reset", model,
{ headers, responseType: 'text' });
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);
}
}
+11 -1
View File
@@ -8,6 +8,7 @@ import { isEmpty } from 'rxjs/operators';
export class I18nService {
locale: String;
locales = ["de-informal"];
i18n: any;
constructor(private http: HttpClient) {
@@ -17,15 +18,24 @@ export class I18nService {
browserLocale = browserLocale.split("-")[0];
}
let locale = localStorage.getItem("bstly.locale") || browserLocale || 'en';
let locale = localStorage.getItem("bstly.locale") || browserLocale || this.locales[0];
if (locale == 'de') {
locale = 'de-informal';
}
if (this.locales.indexOf(locale) == -1) {
locale = this.locales[0];
}
this.setLocale(locale);
}
getLocales() {
return this.locales;
}
getLocale() {
return this.locale;
}
+4
View File
@@ -15,6 +15,10 @@ export class UserService {
return this.http.post(environment.apiUrl + "/users", userModel);
}
checkModel(userModel) {
return this.http.post(environment.apiUrl + "/users/model", userModel);
}
password(passwordModel) {
return this.http.patch(environment.apiUrl + "/users/password", passwordModel);
}