employees edit form
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
@@ -49,12 +50,14 @@
|
||||
public IPrincipal GetClaimsPrincipal(string token)
|
||||
{
|
||||
var claimsIdentity = anonymous;
|
||||
var tokenData = this.employeesRepository.GetTokenData(token);
|
||||
|
||||
if (this.employeesRepository.TokenExists(token))
|
||||
if (tokenData != null)
|
||||
{
|
||||
var employee = this.employeesRepository.GetEmployee(token);
|
||||
var employee = this.employeesRepository.Find(tokenData.EmployeeId);
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim(nameof(EmployeeToken.AppId), tokenData.AppId.ToString()),
|
||||
new Claim(nameof(employee.EmployeeId), employee.EmployeeId.ToString()),
|
||||
new Claim(nameof(employee.FullName), employee.FullName),
|
||||
new Claim(nameof(employee.Username), employee.Username),
|
||||
@@ -88,5 +91,14 @@
|
||||
|
||||
return new ClaimsPrincipal(claimsIdentity);
|
||||
}
|
||||
|
||||
public void ResetPassword(short employeeId)
|
||||
{
|
||||
this.employeesRepository.ResetPassword(employeeId);
|
||||
this.employeesRepository.ResetTokens(employeeId);
|
||||
}
|
||||
|
||||
public void SetPassword(short employeeId, string password)
|
||||
=> this.employeesRepository.SetPassword(employeeId, password);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user