Skip to content
Snippets Groups Projects
Commit e3e4e9dd authored by Tom Käsler's avatar Tom Käsler
Browse files

Add button for account activation reset

parent 1b30c2a0
No related merge requests found
Pipeline #31386 failed with stages
in 8 minutes and 57 seconds
......@@ -8,7 +8,12 @@
<mat-placeholder class="placeholder">{{ 'login.activation-key' | translate }}</mat-placeholder>
<mat-error *ngIf="activationKeyFormControl.hasError('required')">{{ 'login.activation-key-required' | translate }}</mat-error>
</mat-form-field>
</form>
</form><div fxLayout="column" fxLayoutAlign="space-around">
<button (click)="resetActivation()" mat-flat-button type="button"
matTooltip="{{'login.restart-account-activation-tooltip' | translate}}">
{{ 'login.restart-account-activation-button' | translate }}
</button>
</div>
<app-dialog-action-buttons
buttonsLabelSection="login"
confirmButtonLabel="activate"
......
.mat-flat-button {
color: var(--on-primary);
background-color: var(--primary);
}
......@@ -50,6 +50,16 @@ export class UserActivationComponent implements OnInit {
return () => this.dialogRef.close();
}
resetActivation(): void {
this.userService.resetActivation(this.data.name.trim()).subscribe(
ret => {
this.translationService.get('login.restart-account-activation-correct').subscribe(message => {
this.notificationService.show(message);
});
}
);
}
/**
* Returns a lambda which executes the dialog dedicated action on call.
......
......@@ -14,7 +14,9 @@ export class UserService extends BaseHttpService {
private apiUrl = {
base: '/api',
user: '/user',
activate: '/activate'
activate: '/activate',
resetActivation: '/resetactivation',
find: '/find'
};
constructor(private http: HttpClient) {
......@@ -29,6 +31,17 @@ export class UserService extends BaseHttpService {
}, httpOptions);
}
resetActivation(username: string): Observable<User> {
const connectionUrl: string = this.apiUrl.base +
this.apiUrl.user +
'/~' + encodeURIComponent(username) +
this.apiUrl.resetActivation;
return this.http.post<any>(connectionUrl, httpOptions).pipe(
tap(_ => ''),
catchError(this.handleError<User>('resetActivation'))
);
}
delete(id: string): Observable<User> {
const connectionUrl: string = this.apiUrl.base + this.apiUrl.user + '/' + id;
return this.http.delete<User>(connectionUrl, httpOptions).pipe(
......@@ -36,4 +49,15 @@ export class UserService extends BaseHttpService {
catchError(this.handleError<User>('deleteUser'))
);
}
getIdByLoginId(loginId: string): Observable<User[]> {
const url = `${this.apiUrl.base + this.apiUrl.user + this.apiUrl.find}`;
return this.http.post<User[]>(url, {
properties: { loginId: loginId },
externalFilters: {}
}).pipe(
tap(() => ''),
catchError(this.handleError('getUserId', []))
);
}
}
......@@ -129,6 +129,9 @@
"password-required": "Passwort erforderlich",
"password-reset": "Passwort vergessen?",
"register": "Registrieren",
"restart-account-activation-button": "Erneut senden",
"restart-account-activation-correct": "Ein neuer Schlüssel wurde gesendet!",
"restart-account-activation-tooltop": "Sendet einen neuen Aktivierungsschlüssel an die angegebene Adresse",
"welcome": "Online fragen & Fragen bewerten"
},
"password-reset": {
......
......@@ -131,6 +131,9 @@
"password-required": "Password required",
"password-reset": "Forgot your password?",
"register": "Register",
"restart-account-activation-button": "Resend",
"restart-account-activation-correct": "New mail got send!",
"restart-account-activation-tooltop": "Sends a new activation key",
"welcome": "Ask online & vote questions"
},
"password-reset": {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment