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

This commit is contained in:
tidusjar 2021-05-22 23:05:32 +01:00
commit dee2abcb38
3 changed files with 34 additions and 23 deletions

View file

@ -145,13 +145,14 @@
<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>
<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="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>
<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>

View file

@ -1,9 +1,10 @@
import { Location } from "@angular/common";
import { AfterViewInit, Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { ActivatedRoute, Router } from "@angular/router";
import { Component, OnInit } from "@angular/core";
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 { IdentityService, RadarrService, SonarrService, MessageService } from "../services";
import { Clipboard } from '@angular/cdk/clipboard';
import { Location } from "@angular/common";
@Component({
templateUrl: "./usermanagement-user.component.html",
@ -27,12 +28,17 @@ export class UserManagementUserComponent implements OnInit {
public countries: string[];
private customization: ICustomizationSettings;
private accessToken: string;
constructor(private identityService: IdentityService,
private notificationService: MessageService,
private readonly settingsService: SettingsService,
private router: Router,
private route: ActivatedRoute,
private sonarrService: SonarrService,
private radarrService: RadarrService,
private clipboard: Clipboard,
private location: Location) {
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.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) {
this.user = {
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() {
this.location.back();
}

View file

@ -1,23 +1,19 @@
import { CommonModule } from "@angular/common";
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 { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { IdentityService, PlexService, RadarrService, SonarrService } from "../services";
import { RouterModule, Routes } from "@angular/router";
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 { PipeModule } from "../pipes/pipe.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 = [
{ path: "", component: UserManagementComponent, canActivate: [AuthGuard] },