private async Task <User> GetIdentity(ProjectorContext userContext, string email, string password)
        {
            SHA1 sha1 = SHA1.Create();

            password = GetString(sha1.ComputeHash(GetBytes(password)));
            //password = ToUnicode(password);
            var user = await userContext.User.FirstOrDefaultAsync(x => x.Email == email);

            if (user == null)
            {
                return(null);
            }

            if (user.Password == password)
            {
                return(user);
            }

            // Credentials are invalid, or account doesn't exist.
            return(null);
        }
Esempio n. 2
0
 public UserWwwController(ProjectorContext db, IUserWwwManager wm)
 {
     _db = db;
     _wm = wm;
 }
Esempio n. 3
0
 // Construct the UserPackagesController using instances to it's dependencies using Dependency Injection.
 public UserPackagesController(INpmRegistry npm, IUserPackageManager pacman, ProjectorContext db)
 {
     _npm    = npm;
     _pacman = pacman;
     _db     = db;
 }
Esempio n. 4
0
 public HomeController(ProjectorContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public UserController(ProjectorContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 // Construct the UserFilesController using instances to it's dependencies using Dependency Injection.
 public UserFilesController(IUserFileManager fm, ProjectorContext db)
 {
     _fm = fm;
     _db = db;
 }