MoK: Passwort ändern ist jetzt möglich und testbereit.
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using System.Windows.Forms;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.Plugins;
|
||||
using BeWo.Service.ServiceImplementations;
|
||||
using BeWo.View.Navigation.Filter;
|
||||
@@ -26,6 +27,8 @@ using DevExpress.XtraScheduler.Compatibility;
|
||||
using Newtonsoft.Json;
|
||||
using static BS.Shared.ServiceRecordValidationResult;
|
||||
using FormCollection = System.Web.Mvc.FormCollection;
|
||||
using GoalRating = BeWoPlanerMobil.Util.GoalRating;
|
||||
using Image = System.Drawing.Image;
|
||||
using ServiceRecordDC = BS.Shared.DataContracts.ServiceRecordDC;
|
||||
|
||||
namespace BeWoPlanerMobil.Controllers
|
||||
@@ -101,6 +104,28 @@ namespace BeWoPlanerMobil.Controllers
|
||||
var mokSessionTimeout = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MoKSessionTimeout, 20);
|
||||
|
||||
Session.Timeout = mokSessionTimeout;
|
||||
|
||||
Model.IsPasswordSecurityEnabled = UserSettingsUtils.GetSettingValueAsBool(Model.Mandator.Settings, SettingsKeys.IsPasswordSecurityActiv);
|
||||
|
||||
if(Model.IsPasswordSecurityEnabled)
|
||||
{
|
||||
var tempDataValue = string.Empty;
|
||||
|
||||
switch(MobileSessionFacade.PasswordStrength)
|
||||
{
|
||||
case 0:
|
||||
tempDataValue = "Sie benutzen ein sehr schwaches Passwort.<br/><br/>Bitte ändern Sie Ihr Passwort, indem Sie im Menü auf 'Password ändern' klicken.";
|
||||
break;
|
||||
case 1:
|
||||
tempDataValue = "Sie benutzen ein schwaches Passwort.<br/><br/>Bitte ändern Sie Ihr Passwort, indem Sie im Menü auf 'Password ändern' klicken.";
|
||||
break;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(tempDataValue))
|
||||
{
|
||||
TempData["show_pw_change_popup"] = tempDataValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var mandatorSettings = Model.Mandator.Settings;
|
||||
@@ -3807,14 +3832,23 @@ namespace BeWoPlanerMobil.Controllers
|
||||
return RedirectToActionPermanent("Main");
|
||||
}
|
||||
|
||||
var passwordUtils = new PasswordUtils();
|
||||
if(passwordUtils.EvaluatePasswordStrength(newPassword) < 2)
|
||||
{
|
||||
var checkResult = UserService.CheckPassword(MobileSessionFacade.LoggedInUser.Oid.Value, oldPassword, newPassword);
|
||||
|
||||
if(!(checkResult is null))
|
||||
{
|
||||
TempData["passwd-change-error"] = checkResult;
|
||||
return RedirectToActionPermanent("Main");
|
||||
}
|
||||
}
|
||||
|
||||
var userName = MobileSessionFacade.LoggedInUserDC.LoginName;
|
||||
var userVersion = MobileSessionFacade.LoggedInUserDC.UserVersion.Value;
|
||||
|
||||
// ToDo: Testen! falsches oldPassword, kein oldPassword, newPassword stimmt nicht mit confirmationPassword überein, kein confirmationPassword, kein newPassword
|
||||
UserService.ChangePassword(userName, userVersion, oldPassword, newPassword);
|
||||
|
||||
// ToDo: Regeln beachten, welche Passwortstärke mindestens erreicht werden muss.
|
||||
|
||||
return RedirectToActionPermanent("Main");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user