aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-15 22:50:19 +0200
committertranstrike <transtrike@gmail.com>2020-12-15 22:50:19 +0200
commit0c7b27b3855ceba1fb55167862e14fca230c7349 (patch)
tree6cb2207257d97012505cf96d7cb91654dcdf0ae9
parent1b60eff0bd759661221a4314d1931069f6ef371c (diff)
downloadDevHive-0c7b27b3855ceba1fb55167862e14fca230c7349.tar
DevHive-0c7b27b3855ceba1fb55167862e14fca230c7349.tar.gz
DevHive-0c7b27b3855ceba1fb55167862e14fca230c7349.zip
Added public const Role
-rw-r--r--src/DevHive.Data/Models/Role.cs4
-rw-r--r--src/DevHive.Services/Services/UserService.cs2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/DevHive.Data/Models/Role.cs b/src/DevHive.Data/Models/Role.cs
index 974add1..b4c7009 100644
--- a/src/DevHive.Data/Models/Role.cs
+++ b/src/DevHive.Data/Models/Role.cs
@@ -6,5 +6,7 @@ namespace DevHive.Data.Models
{
[Table("Roles")]
public class Role : IdentityRole<Guid>
- { }
+ {
+ public const string DefaultRole = "User";
+ }
}
diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs
index 331545a..a0eea9f 100644
--- a/src/DevHive.Services/Services/UserService.cs
+++ b/src/DevHive.Services/Services/UserService.cs
@@ -53,7 +53,7 @@ namespace DevHive.Services.Services
return new BadRequestObjectResult("Email already exists!");
User user = this._userMapper.Map<User>(registerModel);
- user.Role = "User";
+ user.Role = Role.DefaultRole;
user.PasswordHash = GeneratePasswordHash(registerModel.Password);
await this._userRepository.AddAsync(user);