Added LoggedOut view

pull/4476/head
Galip Tolga Erdem 5 years ago
parent 010399e237
commit da545f3d8d

@ -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}"
}
}

@ -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."
}
}
}

@ -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");
}
}

@ -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<AccountResource> L
@section scripts {
<abp-script-bundle name="@typeof(LoggedOutModel).FullName">
<abp-script src="/Pages/Account/LoggedOut.js"/>
</abp-script-bundle>
}
@section styles {
<abp-style src="/Pages/Account/LoggedOut.css"/>
}
<abp-card>
<abp-card-body>
<abp-card-title>@L["LoggedOutTitle"]</abp-card-title>
<abp-card-text>@L["LoggedOutText"]</abp-card-text>
@if (Model.PostLogoutRedirectUri != null)
{
<a abp-button="Primary" class="redirectButton" href="@Model.PostLogoutRedirectUri">@L["ReturnToText", Model.ClientName]</a>
}
@if (Model.SignOutIframeUrl != null)
{
<iframe class="signout logoutiframe" src="@Model.SignOutIframeUrl"></iframe>
}
</abp-card-body>
</abp-card>

@ -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<IActionResult> OnGetAsync()
{
return Task.FromResult<IActionResult>(Page());
}
public virtual Task<IActionResult> OnPostAsync()
{
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -0,0 +1,5 @@
.logoutiframe {
display: none;
width:0;
height: 0;
}

@ -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)
Loading…
Cancel
Save