Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/users
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/actions/build-and-deploy-api/action.yml
#	.github/workflows/next-deployment.yml
#	apps/api/src/.env.template
#	apps/spa/src/app/app.module.ts
#	apps/spa/src/environments/environment.ts
#	libs/spa/auth/src/lib/components/dev-login.component.ts
#	package-lock.json
#	package.json
  • Loading branch information
timonmasberg committed Jan 20, 2024
1 parent bc9ac9e commit 50566eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 2 additions & 0 deletions apps/spa/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
import de from '@angular/common/locales/de';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import DOMPurify from 'dompurify';
import { NZ_I18N, de_DE } from 'ng-zorro-antd/i18n';
Expand All @@ -26,6 +27,7 @@ registerLocaleData(de);
declarations: [AppComponent, ProtectedComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot(routes),
HttpClientModule,
environment.oauth
Expand Down
3 changes: 2 additions & 1 deletion libs/spa/auth/src/lib/components/dev-login.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { createMock } from '@golevelup/ts-jest';
import { SpectatorRouting, createRoutingFactory } from '@ngneat/spectator/jest';
import { NzButtonComponent } from 'ng-zorro-antd/button';
import { NzSelectModule } from 'ng-zorro-antd/select';

import { Role } from '@kordis/shared/auth';

Expand All @@ -14,7 +15,7 @@ describe('DevLoginComponent', () => {
const authServiceMock = createMock<DevAuthService>();
const createComponent = createRoutingFactory({
component: DevLoginComponent,
imports: [ReactiveFormsModule, NzButtonComponent],
imports: [ReactiveFormsModule, NzButtonComponent, NzSelectModule],
componentProviders: [
{
provide: AUTH_SERVICE,
Expand Down
23 changes: 15 additions & 8 deletions libs/spa/auth/src/lib/components/dev-login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,26 @@ import { DevAuthService } from '../services/dev-auth.service';
template: `
<div class="container">
<div>
@for (username of usernames; let i = $index) {
@for (username of usernames; track i; let i = $index) {
<button
nz-button
(click)="loginAsTestuser(i)"
[attr.data-username]="username"
>
Login as <b>{{ username }}</b>
Login as <b> {{ username }}</b>
</button>
}
</div>
<form [formGroup]="customClaimsForm" (ngSubmit)="loginWithCustomClaims()">
<label for="id">ID</label>
<input nz-input id="id" type="text" formControlName="id" />
<label for="orgId">Organization ID</label>
<input
nz-input
id="orgId"
type="text"
formControlName="organizationId"
/>
<label for="firstName">First name</label>
<input
nz-input
Expand All @@ -60,12 +67,12 @@ import { DevAuthService } from '../services/dev-auth.service';
<input nz-input id="lastName" type="text" formControlName="lastName" />
<label for="email">Email</label>
<input nz-input id="email" type="text" formControlName="email" />
<label for="role">Role</label>
<select name="role" formControlName="role">
<option value="user">User</option>
<option value="admin">Admin</option>
<option value="organization_admin">Org Admin</option>
</select>
<label>Role</label>
<nz-select formControlName="role">
<nz-option nzValue="user" nzLabel="User" />
<nz-option nzValue="admin" nzLabel="Admin" />
<nz-option nzValue="organization_admin" nzLabel="Org Admin" />
</nz-select>
<button nz-button nzSize="large" nzType="primary" type="submit">
Login as Custom user
</button>
Expand Down
3 changes: 3 additions & 0 deletions libs/spa/auth/src/lib/dev-auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { NzButtonComponent } from 'ng-zorro-antd/button';
import { NzInputDirective } from 'ng-zorro-antd/input';
import { NzOptionComponent, NzSelectComponent } from 'ng-zorro-antd/select';

import { BaseAuthModule } from './auth.module';
import { DevLoginComponent } from './components/dev-login.component';
Expand All @@ -26,6 +27,8 @@ import { DevAuthService } from './services/dev-auth.service';
]),
NzButtonComponent,
NzInputDirective,
NzSelectComponent,
NzOptionComponent,
],
exports: [RouterModule],
})
Expand Down

0 comments on commit 50566eb

Please sign in to comment.