Пример #1
0
 public async void UpdatePersonalData(BllUserProfile model)
 {
     var user = await _userRep.Get(model.Id);
     user.Name = model.Name;
     user.Email = model.Email;
     _userRep.Update(user);
     _uow.Commit();
     ((ClaimsIdentity)Identity.Identity).RemoveClaim(((ClaimsIdentity)Identity.Identity).FindFirst(ClaimTypes.Name));
     ((ClaimsIdentity)Identity.Identity).RemoveClaim(((ClaimsIdentity)Identity.Identity).FindFirst(ClaimTypes.Email));
     ((ClaimsIdentity)Identity.Identity).AddClaim(new Claim(ClaimTypes.Name, user.Name));
     ((ClaimsIdentity)Identity.Identity).AddClaim(new Claim(ClaimTypes.Name, user.Email));
 }
Пример #2
0
 internal static ApiUserProfile ToApiUserProfile(BllUserProfile user)
 {
     if (user != null)
         return new ApiUserProfile
         {
             Email = user.Email,
             Id = user.Id,
             Name = user.Name,
             Password = user.Password,
             Photo = user.Photo,
             TimeRegister = user.TimeRegister
         };
     return null;
 }
Пример #3
0
 public async Task<ClaimsIdentity> Autorization(BllUserProfile blluserprofile)
 {
     ClaimsIdentity claim = null;
     var user = await _userRep.Get(blluserprofile.Email);
     if (user != null && Crypto.SHA1(blluserprofile.Password) == user.Password)
     {
         claim = new ClaimsIdentity("ApplicationCookie", ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType);
         claim.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id.ToString(), ClaimValueTypes.String));
         claim.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, user.Name, ClaimValueTypes.String));
         claim.AddClaim(new Claim(ClaimTypes.Email, user.Email, ClaimValueTypes.String));
         claim.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "OWIN Provider", ClaimValueTypes.String));
     }
     return claim;
 }
Пример #4
0
 public void CreateUserProfile(BllUserProfile userProfile)
 {
     userProfile.Password = Crypto.SHA1(userProfile.Password);
     _userRep.Add(Mapper.ToDalUserProfile(userProfile));
     _uow.Commit();
 }