PTMagic/Monitor/Pages/SetupPassword.cshtml.cs

31 lines
780 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 {
public string ValidationMessage = "";
public void OnGet() {
base.PreInit();
}
public void OnPost(string password, string passwordConfirm) {
if (!password.Equals(passwordConfirm)) {
ValidationMessage = "Password does not match the confirmation!";
}
if (ModelState.IsValid) {
base.PreInit();
PTMagicConfiguration.WriteSecureSettings(password, PTMagicBasePath);
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
}
}
}
}