notification service and user management improvements
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
@page "/login"
|
||||
@page "/pages/login"
|
||||
@namespace Oqtane.Pages
|
||||
@model Oqtane.Pages.LoginModel
|
||||
|
@ -1,3 +1,3 @@
|
||||
@page "/logout"
|
||||
@page "/pages/logout"
|
||||
@namespace Oqtane.Pages
|
||||
@model Oqtane.Pages.LogoutModel
|
||||
|
3
Oqtane.Server/Pages/Verify.cshtml
Normal file
3
Oqtane.Server/Pages/Verify.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@page "/pages/verify"
|
||||
@namespace Oqtane.Pages
|
||||
@model Oqtane.Pages.VerifyModel
|
42
Oqtane.Server/Pages/Verify.cshtml.cs
Normal file
42
Oqtane.Server/Pages/Verify.cshtml.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Repository;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Pages
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public class VerifyModel : PageModel
|
||||
{
|
||||
private readonly IUserRepository Users;
|
||||
private readonly UserManager<IdentityUser> IdentityUserManager;
|
||||
|
||||
public VerifyModel(IUserRepository Users, UserManager<IdentityUser> IdentityUserManager)
|
||||
{
|
||||
this.Users = Users;
|
||||
this.IdentityUserManager = IdentityUserManager;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGet(string name, string token, string returnurl)
|
||||
{
|
||||
int verified = 0;
|
||||
IdentityUser identityuser = await IdentityUserManager.FindByNameAsync(name);
|
||||
if (identityuser != null)
|
||||
{
|
||||
var result = await IdentityUserManager.ConfirmEmailAsync(identityuser, token);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
verified = 1;
|
||||
}
|
||||
}
|
||||
if (!returnurl.StartsWith("/"))
|
||||
{
|
||||
returnurl += "/" + returnurl;
|
||||
}
|
||||
return Redirect(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + returnurl + "login?verified=" + verified.ToString());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user