Skip to content

Commit

Permalink
linked to login post method #44
Browse files Browse the repository at this point in the history
  • Loading branch information
RumiAust authored and raghunandanarava committed Jun 7, 2022
1 parent a87e728 commit 28ffc6a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/user/Dto/LoginUser.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { IsEmail, IsNotEmpty } from 'class-validator';

export class LoginUserDto {
@IsEmail()
email: string;
user_email: string;

@IsNotEmpty()
password: string;
user_password: string;
}
4 changes: 2 additions & 2 deletions src/user/user.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Body, Controller, Get, Post, Render} from '@nestjs/common';
import {Body, Controller, Get, Post, Query, Render} from '@nestjs/common';
import { UserService } from './user.service';
import { LoginUserDto } from './Dto/LoginUser.dto';

Expand All @@ -7,7 +7,7 @@ export class UserController {
constructor(private readonly userService: UserService) {}

@Post('login')
login(@Body() loginUserDto: LoginUserDto) {
async login(@Body() loginUserDto: LoginUserDto) {
return this.userService.login(loginUserDto);
}

Expand Down
4 changes: 2 additions & 2 deletions src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LoginUserDto } from './Dto/LoginUser.dto';

@Injectable()
export class UserService {
login(loginUserDto: LoginUserDto): string {
return 'Login Successful';
login(loginUserDto: LoginUserDto): { result: string } {
return { result:'Login Successful' };
}
}
9 changes: 6 additions & 3 deletions views/login.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
<body>
<div class="center">
<h3>Please Enter your Email and Password to Login</h3>
<form method="post" action="/api/user/login">
<label for="user_email"><b>Email: </b></label><br>
<input type="text" id="user_email" name="user_email"><br>
<input type="text" id="user_email" name="user_email" class="dto"><br>
<label for="user_password"><b>Password: </b></label><br>
<input type="text" id="user_password" name="user_password"><br><br>
<button id="btn_login" class="button loginButton">Login</button>
<input type="password" id="user_password" name="user_password" class="dto"><br><br>
<button id="submit" type="submit" value="submit" >Submit</button>
</form>
<button id="btn_back" onclick="location.href = 'http://localhost:8081/api/discovery/issuer';" class="button backButton">Back to Discovery</button><br><br>
{{result}}
</div>
</body>
</html>

0 comments on commit 28ffc6a

Please sign in to comment.