init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,54 @@
|
|||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Exceptions;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.Web.Areas.Adminisztracio.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.ReCaptcha;
|
||||
|
||||
namespace Kreta.Web.Areas.Adminisztracio.Controllers
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public class JelszoValtoztatoController : Controller
|
||||
{
|
||||
public ActionResult Index(string guid)
|
||||
{
|
||||
var model = new JelszoValtoztatoModel { Guid = guid };
|
||||
|
||||
try
|
||||
{
|
||||
model.IsSzulDatumValidacio = new JelszoLinkHelper(ConnectionTypeExtensions.GetOrganizationConnectionType(), guid).IsSzulDatumValidacio();
|
||||
}
|
||||
catch (KretaJelszoModositasException e)
|
||||
{
|
||||
model.ErrorMessage = e.Message;
|
||||
}
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public JsonResult SaveJelszo(JelszoValtoztatoModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
Response.StatusCode = 400;
|
||||
Response.TrySkipIisCustomErrors = true;
|
||||
|
||||
var modelErrors = ModelState.AllErrors();
|
||||
return Json(modelErrors);
|
||||
}
|
||||
|
||||
var captcha = ReCaptchaValidator.Validate(model.ReCaptcha);
|
||||
|
||||
if (!captcha.Success)
|
||||
{
|
||||
return Json(new IsSuccessResponseCo(false, string.Join(",", captcha.ErrorCodes)));
|
||||
}
|
||||
|
||||
IsSuccessResponseCo response = new JelszoLinkHelper(ConnectionTypeExtensions.GetOrganizationConnectionType(), model.Guid).SaveJelszo(model.ConvertToCo());
|
||||
|
||||
return Json(response);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue