import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { UserRight } from '../../../../shared/models/users/user-right.enum'
-import { AuthService, AuthStatus, ServerService } from '../core'
+import { AuthService, AuthStatus, RedirectService, ServerService } from '../core'
import { User } from '../shared/users/user.model'
@Component({
constructor (
private authService: AuthService,
private serverService: ServerService,
- private router: Router
+ private redirectService: RedirectService
) {}
ngOnInit () {
}
isRegistrationAllowed () {
- return this.serverService.getConfig().signup.allowed
+ return this.serverService.getConfig().signup.allowed &&
+ this.serverService.getConfig().signup.allowedForCurrentIP
}
getFirstAdminRightAvailable () {
this.authService.logout()
// Redirect to home page
- this.router.navigate(['/videos/list'])
+ this.redirectService.redirectToHomepage()
}
private computeIsUserHasAdminAccess () {