PTMagic/Monitor/Pages/SetupPassword.cshtml.cs

37 lines
839 B
C#
Raw Normal View History

2018-05-22 10:11:50 +02:00
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Core.Main;
namespace Monitor.Pages
{
public class SetupPasswordModel : _Internal.BasePageModel
{
2018-05-22 10:11:50 +02:00
public string ValidationMessage = "";
public void OnGet()
{
2018-05-22 10:11:50 +02:00
base.PreInit();
}
public void OnPost(string password, string passwordConfirm)
{
if (!password.Equals(passwordConfirm))
{
base.PreInit();
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "SetupPassword");
2018-05-22 10:11:50 +02:00
}
else if (ModelState.IsValid)
{
2018-05-22 10:11:50 +02:00
base.PreInit();
PTMagicConfiguration.WriteSecureSettings(password);
2018-05-22 10:11:50 +02:00
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
}
}
}
}