Exemple #1
0
        public async Task <ActionResult> Index(UpdateResourceOwnerViewModel updateResourceOwnerViewModel)
        {
            if (updateResourceOwnerViewModel == null)
            {
                throw new ArgumentNullException(nameof(updateResourceOwnerViewModel));
            }

            var authenticatedUser = await this.GetAuthenticatedUser(Constants.CookieName);

            if (authenticatedUser != null &&
                authenticatedUser.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "User"));
            }

            await _accountActions.AddResourceOwner(new AddUserParameter
            {
                Login    = updateResourceOwnerViewModel.Login,
                Password = updateResourceOwnerViewModel.Password
            });

            return(RedirectToAction("Index", "Authenticate"));
        }