Add duplicated user error on create

pull/10/head
Florian Hartwich 2017-09-15 21:02:43 +02:00
parent 17b31df9a6
commit 5a7f002bdd
3 changed files with 24 additions and 7 deletions

View File

@ -39,7 +39,6 @@ const createAllSignatures = () => {
+ ': finished successful - UPDATE SIGNATURES');
})
});
};
const createBackup = () => {
@ -55,11 +54,10 @@ const createBackup = () => {
})
};
// Execute daily @ 02:30 AM
const cronJobSignature = cron.job('00 30 02 * * *', createAllSignatures);
// Execute every on Mon, Thu and Sat @ 04:00 AM
// Execute on Mon, Thu and Sat @ 04:00 AM
const cronJobBackup = cron.job('00 00 04 * * mon,thu,sat', createBackup);
module.exports = {

View File

@ -57,10 +57,15 @@
Bestätigen
</button>
<span *ngIf="showErrorLabel"
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
{{error}}
</span>
<span *ngIf="showSuccessLabel"
class="label label-success label-small"
style="margin-left: inherit">
Erfolgreich gespeichert
Erfolgreich gespeichert
</span>
</form>

View File

@ -28,6 +28,10 @@ export class EditUserComponent {
ranksDisplay = 'none';
showErrorLabel = false;
error: string;
constructor(private router: Router,
private route: ActivatedRoute,
private userService: UserService,
@ -98,9 +102,19 @@ export class EditUserComponent {
} else {
this.userService.submitUser(updateObject)
.subscribe(user => {
this.router.navigate(['..'], {relativeTo: this.route});
return true;
})
this.router.navigate(['..'], {relativeTo: this.route});
return true;
},
error => {
// duplicated user error message
if (error._body.indexOf('duplicate') >= 0) {
this.error = "Benutzername existiert bereits";
this.showErrorLabel = true;
setTimeout(() => {
this.showErrorLabel = false;
}, 5000);
}
})
}
}