public async Task <IActionResult> Post(AuthenticationModel authentication)
        {
            //var person = new Person
            //{
            //    PersonName = "abc"
            //};
            //await LoginUow.RegisterNewAsync<Person>(person);
            //await LoginUow.CommitAsync();
            var person = LoginUow.Repository <Person>().FindByKey(15);
            await LoginUow.RegisterDeletedAsync <Person>(person);

            await LoginUow.CommitAsync();

            var user = await LoginUow.Repository <vUser>().SingleOrDefaultAsync(t => t.UserName == authentication.UserName && !t.LoginBlocked);

            if (user != null && PasswordHash.VerifySignature(authentication.Password, user.Password, user.Salt))
            {
                var token = await ApplicationTokenProvider.GetTokenAsync(user);

                return(Ok(token));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> Post(AuthenticationModel authentication)
        {
            var user = await LoginUow.Repository <vUser>().SingleOrDefaultAsync(t => t.UserName == authentication.UserName && !t.LoginBlocked);

            if (user != null && PasswordHash.VerifySignature(authentication.Password, user.Password, user.Salt))
            {
                var token = await ApplicationTokenProvider.GetTokenAsync(user);

                return(Ok(token));
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 3
0
        public async Task <object> GetBy(AppUser parameters)
        {
            var result = await Uow.Repository <AppUser>().SingleOrDefaultAsync(t => t.UserName == parameters.UserName);

            if (result != null && PasswordHash.VerifySignature(parameters.userPassword, result.Password, result.Salt))
            {
                var token = await ApplicationTokenProvider.GetTokenAsync(result);

                result.token = token;
                return(result);
            }
            else
            {
                return(await Task.FromResult("Try Again Please"));
            }
            //throw new NotImplementedException();
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Get()
        {
            var token = await ApplicationTokenProvider.GetTokenAsync(new vUser { UserId = 0, ApplicationTimeZoneName = string.Empty, LanguageCode = string.Empty });

            return(Ok(token));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Get()
        {
            var token = await ApplicationTokenProvider.GetTokenAsync(new AppUser { AppUserId = 0 });

            return(Ok(token));
        }