aboutsummaryrefslogtreecommitdiff
path: root/API
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-12 18:14:08 +0200
committertranstrike <transtrike@gmail.com>2020-12-12 18:14:08 +0200
commit68836192e1138e2590cbde0c8110507b59ebeed1 (patch)
tree1385c625d5c2b4991044817f7d906433f31f1fd5 /API
parent64e02c270d2911e85ea82b601e2aa251400fbcd0 (diff)
downloadDevHive-68836192e1138e2590cbde0c8110507b59ebeed1.tar
DevHive-68836192e1138e2590cbde0c8110507b59ebeed1.tar.gz
DevHive-68836192e1138e2590cbde0c8110507b59ebeed1.zip
New ValidationString implementation; Simplified PictureProfile
Diffstat (limited to 'API')
-rw-r--r--API/Controllers/UserController.cs1
-rw-r--r--API/Extensions/ConfigureJWT.cs12
-rw-r--r--API/Service/UserService.cs9
3 files changed, 15 insertions, 7 deletions
diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs
index 6cb1f54..8503922 100644
--- a/API/Controllers/UserController.cs
+++ b/API/Controllers/UserController.cs
@@ -6,7 +6,6 @@ using Microsoft.AspNetCore.Mvc;
using Data.Models.DTOs;
using Microsoft.AspNetCore.Authorization;
using Data.Models.Options;
-using Microsoft.Extensions.Configuration;
namespace API.Controllers
{
diff --git a/API/Extensions/ConfigureJWT.cs b/API/Extensions/ConfigureJWT.cs
index 1de2aa5..22ada98 100644
--- a/API/Extensions/ConfigureJWT.cs
+++ b/API/Extensions/ConfigureJWT.cs
@@ -12,11 +12,17 @@ namespace API.Extensions
{
public static void JWTConfiguration(this IServiceCollection services, IConfiguration configuration)
{
- services.AddSingleton<JWTOptions>(
- new JWTOptions(configuration.GetSection("AppSettings").GetSection("Secret").Value));
+ services.AddSingleton(new JWTOptions(configuration
+ .GetSection("AppSettings")
+ .GetSection("Secret")
+ .Value));
// Get key from appsettings.json
- var key = Encoding.ASCII.GetBytes(configuration.GetSection("AppSettings").GetSection("Secret").Value);
+ var key = Encoding.ASCII.GetBytes(configuration
+ .GetSection("AppSettings")
+ .GetSection("Secret")
+ .Value);
+
// Setup Jwt Authentication
services.AddAuthentication(x =>
{
diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs
index 797a924..c57b4b7 100644
--- a/API/Service/UserService.cs
+++ b/API/Service/UserService.cs
@@ -34,6 +34,8 @@ namespace API.Service
if (user == null)
return new NotFoundObjectResult("User does not exist!");
+ //TODO: Clean it
+
// Get key from appsettings.json
var key = Encoding.ASCII.GetBytes(_jwtOptions.Secret);
@@ -57,9 +59,9 @@ namespace API.Service
var tokenString = tokenHandler.WriteToken(token);
return new OkObjectResult(new
- {
- Token = tokenString
- });
+ {
+ Token = tokenString
+ });
}
public async Task<IActionResult> RegisterUser(RegisterDTO registerDTO)
@@ -80,6 +82,7 @@ namespace API.Service
private string GeneratePasswordHash(string password)
{
+ //TODO: Hash password
return password; // TEMPORARY!
}