Added the ability for the admin to be able to copy the app link to send to users that have the app installed so they can automatically be authenticated

pull/4204/head
tidusjar 4 years ago
parent 7a85f8ab7c
commit dee2abcb38

@ -145,13 +145,14 @@
<div class="row"> <div class="row">
<div class="col-md-3 col-sm-12"> <div class="col-md-6 col-sm-12">
<button *ngIf="!edit" type="button" mat-raised-button color="accent" data-test="createuserbtn" (click)="create()">Create</button> <button *ngIf="!edit" type="button" mat-raised-button color="accent" data-test="createuserbtn" (click)="create()">Create</button>
<div *ngIf="edit"> <div *ngIf="edit">
<button type="button" data-test="updatebtn" mat-raised-button color="accent" class="btn btn-primary-outline" (click)="update()">Update</button> <button type="button" data-test="updatebtn" mat-raised-button color="accent" class="btn btn-primary-outline" (click)="update()">Update</button>
<button type="button" data-test="deletebtn" mat-raised-button color="warn" class="btn btn-danger-outline" (click)="delete()">Delete</button> <button type="button" data-test="deletebtn" mat-raised-button color="warn" class="btn btn-danger-outline" (click)="delete()">Delete</button>
<button type="button" style="float:right;" mat-raised-button color="primary" class="btn btn-info-outline" (click)="resetPassword()" pTooltip="You need your SMTP settings setup">Send <button type="button" style="float:right;" mat-raised-button color="primary" class="btn btn-info-outline" (click)="resetPassword()" matTooltip="You need your SMTP settings setup">Send
Reset Password Link</button> Reset Password Link</button>
<button *ngIf="customization.applicationUrl" type="button" mat-raised-button color="accent" class="btn btn-info-outline" (click)="appLink()" matTooltip="Send this link to the user and they can then open the app and directly login">Copy users App Link</button>
</div> </div>

@ -1,9 +1,10 @@
import { Location } from "@angular/common"; import { ActivatedRoute, Router } from "@angular/router";
import { AfterViewInit, Component, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router"; import { ICheckbox, ICustomizationSettings, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces";
import { IdentityService, MessageService, RadarrService, SettingsService, SonarrService } from "../services";
import { ICheckbox, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces"; import { Clipboard } from '@angular/cdk/clipboard';
import { IdentityService, RadarrService, SonarrService, MessageService } from "../services"; import { Location } from "@angular/common";
@Component({ @Component({
templateUrl: "./usermanagement-user.component.html", templateUrl: "./usermanagement-user.component.html",
@ -27,12 +28,17 @@ export class UserManagementUserComponent implements OnInit {
public countries: string[]; public countries: string[];
private customization: ICustomizationSettings;
private accessToken: string;
constructor(private identityService: IdentityService, constructor(private identityService: IdentityService,
private notificationService: MessageService, private notificationService: MessageService,
private readonly settingsService: SettingsService,
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private sonarrService: SonarrService, private sonarrService: SonarrService,
private radarrService: RadarrService, private radarrService: RadarrService,
private clipboard: Clipboard,
private location: Location) { private location: Location) {
this.route.params.subscribe((params: any) => { this.route.params.subscribe((params: any) => {
@ -60,6 +66,9 @@ export class UserManagementUserComponent implements OnInit {
this.radarrService.getQualityProfilesFromSettings().subscribe(x => this.radarrQualities = x); this.radarrService.getQualityProfilesFromSettings().subscribe(x => this.radarrQualities = x);
this.radarrService.getRootFoldersFromSettings().subscribe(x => this.radarrRootFolders = x); this.radarrService.getRootFoldersFromSettings().subscribe(x => this.radarrRootFolders = x);
this.settingsService.getCustomization().subscribe(x => this.customization = x);
this.identityService.getAccessToken().subscribe(x => this.accessToken = x);
if(!this.edit) { if(!this.edit) {
this.user = { this.user = {
alias: "", alias: "",
@ -178,7 +187,12 @@ export class UserManagementUserComponent implements OnInit {
} }
}); });
} }
public async appLink() {
this.clipboard.copy(`ombi://${this.customization.applicationUrl}|${this.accessToken}`);
this.notificationService.send("Copied!");
}
public back() { public back() {
this.location.back(); this.location.back();
} }

@ -1,23 +1,19 @@
import { CommonModule } from "@angular/common"; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { NgModule } from "@angular/core";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { RouterModule, Routes } from "@angular/router";
import { ConfirmDialogModule } from "primeng/confirmdialog";
import { MultiSelectModule } from "primeng/multiselect";
import { SidebarModule } from "primeng/sidebar";
import { TooltipModule } from "primeng/tooltip";
import { UserManagementUserComponent } from "./usermanagement-user.component";
import { UserManagementComponent } from "./usermanagement.component";
import { PipeModule } from "../pipes/pipe.module";
import { IdentityService, PlexService, RadarrService, SonarrService } from "../services"; import { IdentityService, PlexService, RadarrService, SonarrService } from "../services";
import { RouterModule, Routes } from "@angular/router";
import { AuthGuard } from "../auth/auth.guard"; import { AuthGuard } from "../auth/auth.guard";
import { CommonModule } from "@angular/common";
import { ConfirmDialogModule } from "primeng/confirmdialog";
import { MultiSelectModule } from "primeng/multiselect";
import { NgModule } from "@angular/core";
import { OrderModule } from "ngx-order-pipe"; import { OrderModule } from "ngx-order-pipe";
import { PipeModule } from "../pipes/pipe.module";
import { SharedModule } from "../shared/shared.module"; import { SharedModule } from "../shared/shared.module";
import { SidebarModule } from "primeng/sidebar";
import { TooltipModule } from "primeng/tooltip";
import { UserManagementComponent } from "./usermanagement.component";
import { UserManagementUserComponent } from "./usermanagement-user.component";
const routes: Routes = [ const routes: Routes = [
{ path: "", component: UserManagementComponent, canActivate: [AuthGuard] }, { path: "", component: UserManagementComponent, canActivate: [AuthGuard] },

Loading…
Cancel
Save