Beispiel #1
0
        public async Task <ActionResult> Edit(User user)
        {
            AuthResult result = await userManager.UpdateAsync(user);

            if (result.Succeeded)
            {
                return(RedirectToAction("Index", "User"));
            }

            ViewData["Error"] = result.ToString();
            return(View());
        }
Beispiel #2
0
 //callback
 public void onAuthenticationReturn(AuthResult ret)
 {
     if (AuthResult.AUTHRET_SUCCESS == ret)
     {
         start_meeting_wnd.Show();
     }
     else
     {
         MessageBox.Show("Failed to authenticate: " + ret.ToString());
         Current.Shutdown();
     }
 }
Beispiel #3
0
        public async Task <ActionResult> ResetPassword(ResetModel reset)
        {
            User user = await userStore.FindByIdAsync(reset.Id, CancellationToken.None);

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

            AuthResult result = await userManager.AdminResetPasswordAsync(user, reset.NewPassword);

            if (result.Succeeded)
            {
                return(RedirectToAction("Index", "User"));
            }

            ViewData["Error"] = result.ToString();
            return(View());
        }
Beispiel #4
0
        public async Task <ActionResult> Create(InputModel newUser)
        {
            User user = Activator.CreateInstance <User>();

            await userStore.SetUserNameAsync(user, newUser.Username, CancellationToken.None);

            IUserEmailStore <User> emailStore = userStore as IUserEmailStore <User>;
            await emailStore.SetEmailAsync(user, newUser.Email, CancellationToken.None);

            AuthResult result = await userManager.CreateAsync(user, newUser.Password);

            if (result.Succeeded)
            {
                logger.LogInformation(LoggerEventIds.UserCreated, "New user created!");
                return(RedirectToAction("Index", "User"));
            }

            ViewData["Error"] = result.ToString();
            return(View());
        }