Passed
Pull Request — master (#406)
by
unknown
01:44
created

server/src/Infrastructure/HumanResource/User/Controller/LoginController.ts   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 22
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A LoginController.post 0 5 1
A LoginController.get 0 5 1
1
import { Controller, Get, Post, Render, Res, UseGuards } from '@nestjs/common';
2
import { Response } from 'express';
3
import { LocalAuthGuard } from '../Security/LocalAuthGuard';
4
import { RouteNameResolver } from 'src/Infrastructure/Common/ExtendedRouting/RouteNameResolver';
5
6
@Controller('login')
7
export class LoginController {
8
  constructor(private readonly resolver: RouteNameResolver) {}
9
10
  @Get()
11
  @Render('pages/login.njk')
12
  public get() {
13
    return {};
14
  }
15
16
  @Post()
17
  @UseGuards(LocalAuthGuard)
18
  public async post(@Res() res: Response) {
19
    res.redirect(303, this.resolver.resolve('home'));
20
  }
21
}
22