Skip to content

Commit

Permalink
Avoid slash in role name (#4442)
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco authored and sebastienros committed Oct 10, 2019
1 parent 52cbccc commit 6ad22b3
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public async Task<IActionResult> Create(CreateRoleViewModel model)
{
model.RoleName = model.RoleName.Trim();

if (model.RoleName.Contains("/"))
{
ModelState.AddModelError(string.Empty, T["Invalid role name."]);
}

if (await _roleManager.FindByNameAsync(_roleManager.NormalizeKey(model.RoleName)) != null)
{
ModelState.AddModelError(string.Empty, T["The role is already used."]);
Expand Down

0 comments on commit 6ad22b3

Please sign in to comment.