Browse Source

Implement external login only.

pull/2177/head
maliming 7 years ago
parent
commit
af68bc2110
  1. 11
      modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs
  2. 7
      modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs
  3. 4
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs

11
modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs

@ -1,4 +1,4 @@
using IdentityModel; using IdentityModel;
using IdentityServer4.Events; using IdentityServer4.Events;
using IdentityServer4.Models; using IdentityServer4.Models;
using IdentityServer4.Services; using IdentityServer4.Services;
@ -40,7 +40,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
IdentityServerEvents = identityServerEvents; IdentityServerEvents = identityServerEvents;
} }
public override async Task OnGetAsync() public override async Task<IActionResult> OnGetAsync()
{ {
LoginInput = new LoginInputModel(); LoginInput = new LoginInputModel();
@ -63,7 +63,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
{ {
LoginInput.UserNameOrEmailAddress = context.LoginHint; LoginInput.UserNameOrEmailAddress = context.LoginHint;
ExternalProviders = new[] { new ExternalProviderModel { AuthenticationScheme = context.IdP } }; ExternalProviders = new[] { new ExternalProviderModel { AuthenticationScheme = context.IdP } };
return; return Page();
} }
var schemes = await _schemeProvider.GetAllSchemesAsync(); var schemes = await _schemeProvider.GetAllSchemesAsync();
@ -96,9 +96,10 @@ namespace Volo.Abp.Account.Web.Pages.Account
if (IsExternalLoginOnly) if (IsExternalLoginOnly)
{ {
//return await ExternalLogin(vm.ExternalLoginScheme, returnUrl); return await base.OnPostExternalLogin(providers.First().AuthenticationScheme);
throw new NotImplementedException();
} }
return Page();
} }
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter

7
modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs

@ -17,10 +17,15 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers
} }
//todo@alper: this method can be moved to AccountController like "account/logout" //todo@alper: this method can be moved to AccountController like "account/logout"
public async Task<IActionResult> Index() public async Task<IActionResult> Index(string returnUrl = null)
{ {
await _signInManager.SignOutAsync(); await _signInManager.SignOutAsync();
if (returnUrl != null)
{
return LocalRedirect(returnUrl);
}
return RedirectToPage("/Account/Login"); return RedirectToPage("/Account/Login");
} }
} }

4
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs

@ -56,7 +56,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
_accountOptions = accountOptions.Value; _accountOptions = accountOptions.Value;
} }
public virtual async Task OnGetAsync() public virtual async Task<IActionResult> OnGetAsync()
{ {
LoginInput = new LoginInputModel(); LoginInput = new LoginInputModel();
@ -80,6 +80,8 @@ namespace Volo.Abp.Account.Web.Pages.Account
//return await ExternalLogin(vm.ExternalLoginScheme, returnUrl); //return await ExternalLogin(vm.ExternalLoginScheme, returnUrl);
throw new NotImplementedException(); throw new NotImplementedException();
} }
return Page();
} }
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter

Loading…
Cancel
Save