Пример #1
0
        // GET: /Account/ConfirmUser
        public async Task <ActionResult> ConfirmUser(int?userId, string token)
        {
            var title        = ErrorTitle;
            var message      = ConcatenateContactAdmin("General.Error");
            var displayAsRaw = false;
            var messageType  = MessageType.Error;

            if (userId.HasValue)
            {
                var accountResult = await _accountManager.ConfirmUserAsync(userId.Value, token, Request);

                switch (accountResult.ResultState)
                {
                case ConfirmUserResultState.EmailNotConfirmed:
                    message = Localize("Identity.Account.ConfirmUser.ConfirmationFailure.Message");
                    break;

                case ConfirmUserResultState.AvatarNotCreated:
                    message     = Localize("Identity.Account.ConfirmUser.AvatarFailure.Message");
                    messageType = MessageType.Warning;
                    break;

                case ConfirmUserResultState.UserConfirmed:
                    title        = Localize("Identity.Account.ConfirmUser.Success.Title");
                    message      = ResHelper.GetStringFormat("Identity.Account.ConfirmUser.Success.Message", Url.Action("SignIn"));
                    displayAsRaw = true;
                    messageType  = MessageType.Info;
                    break;
                }
            }

            return(View("UserMessage", GetPageViewModel(title, message, false, displayAsRaw, messageType)));
        }