diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json index 7cf2cf7be6..f0dbdaadb6 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json @@ -40,6 +40,9 @@ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Is self-registration enabled", "Description:Abp.Account.IsSelfRegistrationEnabled": "Whether a user can register the account by him or herself.", "DisplayName:Abp.Account.EnableLocalLogin": "Authenticate with a local account", - "Description:Abp.Account.EnableLocalLogin": "Indicates if the server will allow users to authenticate with a local account." + "Description:Abp.Account.EnableLocalLogin": "Indicates if the server will allow users to authenticate with a local account.", + "LoggedOutTitle": "Signed Out", + "LoggedOutText": "You have been signed out and you will be redirected soon.", + "ReturnToText": "Click here to redirect to {0}" } } diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json index 60d5f40634..3938a34984 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json @@ -40,6 +40,9 @@ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "self-registration etkin mi ?", "Description:Abp.Account.IsSelfRegistrationEnabled": "Bir kullanıcının hesabı kendisi tarafından kaydedip kaydedememesidir.", "DisplayName:Abp.Account.EnableLocalLogin": "Yerel bir hesapla kimlik doğrulaması", - "Description:Abp.Account.EnableLocalLogin": "Sunucunun, kullanıcıların yerel bir hesapla kimlik doğrulamasına izin verip vermeyeceğini belirtir." + "Description:Abp.Account.EnableLocalLogin": "Sunucunun, kullanıcıların yerel bir hesapla kimlik doğrulamasına izin verip vermeyeceğini belirtir.", + "LoggedOutTitle": "Çıkış Yaptınız", + "LoggedOutText": "Çıkış yaptınız ve birazdan yönlendirileceksiniz.", + "ReturnToText": "{0} uygulamasına dönmek için tıklayın." } -} \ No newline at end of file +} diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs index ab403ea5a1..43857cc111 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs @@ -1,6 +1,8 @@ -using IdentityServer4.Services; +using System.Security.Claims; +using IdentityServer4.Services; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Account.Web.Pages.Account @@ -24,13 +26,20 @@ namespace Volo.Abp.Account.Web.Pages.Account if (!string.IsNullOrEmpty(logoutId)) { var logoutContext = await Interaction.GetLogoutContextAsync(logoutId); + await SignInManager.SignOutAsync(); - var postLogoutUri = logoutContext.PostLogoutRedirectUri; + HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); - if (!string.IsNullOrEmpty(postLogoutUri)) + LoggedOutModel vm = new LoggedOutModel() { - return Redirect(postLogoutUri); - } + PostLogoutRedirectUri = logoutContext?.PostLogoutRedirectUri, + ClientName = logoutContext?.ClientName, + SignOutIframeUrl = logoutContext?.SignOutIFrameUrl + }; + + Logger.LogInformation($"Redirecting to LoggedOut Page..."); + + return RedirectToPage("./LoggedOut", vm); } if (ReturnUrl != null) @@ -38,6 +47,8 @@ namespace Volo.Abp.Account.Web.Pages.Account return LocalRedirect(ReturnUrl); } + Logger.LogInformation( + $"IdentityServerSupportedLogoutModel couldn't find postLogoutUri... Redirecting to:/Account/Login.."); return RedirectToPage("/Account/Login"); } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml new file mode 100644 index 0000000000..3e3e9857a1 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml @@ -0,0 +1,31 @@ +@page "/Account/LoggedOut" +@model Volo.Abp.Account.Web.Pages.Account.LoggedOutModel +@using Volo.Abp.Account.Localization +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.Account.Web.Pages.Account +@inject IHtmlLocalizer L + +@section scripts { + + + +} + +@section styles { + +} + + + + @L["LoggedOutTitle"] + @L["LoggedOutText"] + @if (Model.PostLogoutRedirectUri != null) + { + @L["ReturnToText", Model.ClientName] + } + @if (Model.SignOutIframeUrl != null) + { + + } + + diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml.cs new file mode 100644 index 0000000000..26ff28affc --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.cshtml.cs @@ -0,0 +1,32 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace Volo.Abp.Account.Web.Pages.Account +{ + public class LoggedOutModel : AccountPageModel + { + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ClientName { get; set; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string SignOutIframeUrl { get; set; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string PostLogoutRedirectUri { get; set; } + + public virtual Task OnGetAsync() + { + return Task.FromResult(Page()); + } + + public virtual Task OnPostAsync() + { + return Task.FromResult(Page()); + } + } +} diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.css b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.css new file mode 100644 index 0000000000..75dcda385e --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.css @@ -0,0 +1,5 @@ +.logoutiframe { + display: none; + width:0; + height: 0; +} diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.js b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.js new file mode 100644 index 0000000000..6341b27ea7 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/LoggedOut.js @@ -0,0 +1,6 @@ +(function ($) { + //TODO:gterdem There should be an option to set the redirect delay here + setTimeout(function () { + window.location = $('.redirectButton').attr('href'); + }, 3000) +})(JQuery)