Users : Password change, password requirements, password history, BackupAndSecurity component, ver. 2.18.1313
This commit is contained in:
parent
99b68f1dd6
commit
7f8a5c83ed
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,8 +11,11 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string UserName { get; set; } /// = name, alias, abbreviation
|
||||
public virtual string FullName { get; set; } /// = description
|
||||
public virtual string Tag { get; set; }
|
||||
public virtual int Number { get; set; }
|
||||
public virtual string Password { get; set; }
|
||||
public virtual string Password2 { get; set; }
|
||||
public virtual string Password3 { get; set; }
|
||||
public virtual DateTime LastPwChange { get; set; }
|
||||
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
|
||||
|
||||
|
||||
38
TBF/BenchControl/BackupAndSecurity/Default/Component.cs
Normal file
38
TBF/BenchControl/BackupAndSecurity/Default/Component.cs
Normal file
@ -0,0 +1,38 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using Users;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.BackupAndSecurity.Default
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options.
|
||||
/// </summary>
|
||||
public class Component : ComponentBase, GenericDevices.IBackupAndSecurity
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("BackupAndSecurity.Default({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public int MinPasswdLength { get { return myCfg.MinPasswdLength; } }
|
||||
public int PasswdExpirationPeriodDays { get { return myCfg.PasswdExpirationPeriodDays; } }
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
|
||||
GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
125
TBF/BenchControl/BackupAndSecurity/Default/ComponentCfg.cs
Normal file
125
TBF/BenchControl/BackupAndSecurity/Default/ComponentCfg.cs
Normal file
@ -0,0 +1,125 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.BackupAndSecurity.Default
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int MinPasswdLength;
|
||||
public int PasswdExpirationPeriodDays; /// 0 = validity is not limited
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
public ComponentCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = "BackupAndSecurity";
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
MinPasswdLength = 6;
|
||||
PasswdExpirationPeriodDays = 0;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Minimum password length (characters)",
|
||||
"Password expiration period (days)",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Min. password length = {1} characters, Password expiration period = {2} days", Name, MinPasswdLength, PasswdExpirationPeriodDays);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return MinPasswdLength.ToString();
|
||||
case 1: return PasswdExpirationPeriodDays.ToString();;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: MinPasswdLength = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: PasswdExpirationPeriodDays = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
/// Positive integers and zero are allowed
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ComponentCfg prms)
|
||||
{
|
||||
prms.MinPasswdLength = this.MinPasswdLength;
|
||||
prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.BackupAndSecurity.Default
|
||||
{
|
||||
public class ComponentFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(ComponentCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
TBF/BenchControl/GenericDevices/IBackupAndSecurity.cs
Normal file
17
TBF/BenchControl/GenericDevices/IBackupAndSecurity.cs
Normal file
@ -0,0 +1,17 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Backup and security options
|
||||
/// </summary>
|
||||
public interface IBackupAndSecurity : IComponent
|
||||
{
|
||||
int MinPasswdLength { get; }
|
||||
int PasswdExpirationPeriodDays { get; }
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
public class ProcessData
|
||||
{
|
||||
public static IBackupAndSecurity BackupAndSecurity;
|
||||
public static IBenchInfo BenchInfo;
|
||||
public static IErrorFlags ErrorFlagsComp;
|
||||
public static Output.DB.SensusOracle.Database OracleDB;
|
||||
|
||||
@ -228,6 +228,7 @@ namespace TBF.BenchControl
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
if (cmpnt is Elde.ControlBoardDev) ControlBoard = cmpnt as Elde.ControlBoardDev;
|
||||
if (cmpnt is IBackupAndSecurity) ProcessData.BackupAndSecurity = cmpnt as IBackupAndSecurity;
|
||||
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
|
||||
if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
|
||||
if ((cmpnt is Output.DB.SensusOracle.Database) && (ProcessData.OracleDB == null))
|
||||
|
||||
@ -15,6 +15,7 @@ namespace TBF.BenchControl
|
||||
{
|
||||
Factories = new List<IComponentFactory>();
|
||||
|
||||
Factories.Add(new BackupAndSecurity.Default.ComponentFactory());
|
||||
Factories.Add(new BenchInfo.Munich.ComponentFactory());
|
||||
Factories.Add(new BenchInfo.Extended.ComponentFactory());
|
||||
Factories.Add(new BenchInfo.iPerl.ComponentFactory());
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.1308.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1308.0")]
|
||||
[assembly: AssemblyVersion("2.18.1313.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1313.0")]
|
||||
|
||||
@ -158,6 +158,9 @@
|
||||
<DependentUpon>AmbientCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Ambient\Greco\Factory.cs" />
|
||||
<Compile Include="BenchControl\BackupAndSecurity\Default\Component.cs" />
|
||||
<Compile Include="BenchControl\BackupAndSecurity\Default\ComponentCfg.cs" />
|
||||
<Compile Include="BenchControl\BackupAndSecurity\Default\ComponentFactory.cs" />
|
||||
<Compile Include="BenchControl\BenchInfo\Extended\Component.cs" />
|
||||
<Compile Include="BenchControl\BenchInfo\Extended\ComponentCfg.cs" />
|
||||
<Compile Include="BenchControl\BenchInfo\Extended\ComponentFactory.cs" />
|
||||
@ -588,6 +591,7 @@
|
||||
<DependentUpon>ValveCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IBackupAndSecurity.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IEvaporation.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IParallelOutput.cs" />
|
||||
|
||||
@ -19,6 +19,7 @@ namespace Users
|
||||
|
||||
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
|
||||
public static ISessionFactory SessionFactory;
|
||||
public static ISession CurrentSession;
|
||||
|
||||
/// <summary> Connection string for all sessions </summary>
|
||||
private static string connectionString;
|
||||
@ -101,7 +102,8 @@ namespace Users
|
||||
|
||||
if (SessionFactory == null) SessionFactory = CreateSessionFactory();
|
||||
|
||||
return SessionFactory.OpenSession();
|
||||
CurrentSession = SessionFactory.OpenSession();
|
||||
return CurrentSession;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Users.Forms;
|
||||
using Users.Resources;
|
||||
|
||||
namespace Users.Entities
|
||||
{
|
||||
@ -19,6 +21,8 @@ namespace Users.Entities
|
||||
public virtual string Tag { get; set; }
|
||||
public virtual int Number { get; set; }
|
||||
public virtual string Password { get; set; }
|
||||
public virtual string Password2 { get; set; }
|
||||
public virtual string Password3 { get; set; }
|
||||
public virtual DateTime LastPwChange { get; set; }
|
||||
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
|
||||
|
||||
@ -133,18 +137,68 @@ namespace Users.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks requirements on the password regardless of the password history
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
/// <returns>true when the password is OK</returns>
|
||||
public static bool IsPasswordMeetsRequirements(string password, out string explanation)
|
||||
{
|
||||
int length = string.IsNullOrEmpty(password) ? 0 : password.Length;
|
||||
|
||||
/// Password length must be at least 6
|
||||
if (length < GlobalData.MinPasswdLength)
|
||||
{
|
||||
explanation = string.Format(Strings.Password_must_have_at_least_0_characters, GlobalData.MinPasswdLength);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
explanation = string.Empty;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when password was already used in the past
|
||||
/// </summary>
|
||||
/// <param name="passwordCandidate">Password</param>
|
||||
/// <returns>false when password is new, true when it was used in the past</returns>
|
||||
public virtual bool IsPasswordUsedInPast(string passwordCandidate)
|
||||
{
|
||||
string encryptedPW = EncryptedPassword(passwordCandidate);
|
||||
return (encryptedPW == Password) || (encryptedPW == Password2) || (encryptedPW == Password3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks 'LastPwChange' and returns true when password expired
|
||||
/// </summary>
|
||||
/// <returns></ returns>
|
||||
bool IsPasswordExpired()
|
||||
{
|
||||
if (IsPowerUser() || IsMemberOf(Grp.GID.Administrators) || GlobalData.PasswdExpirationPeriodDays == 0)
|
||||
{
|
||||
/// Password cannot expirate for this user or this feature is disabled in Backup and Security options
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Password expiration time is 3 months
|
||||
return (DateTime.Now - LastPwChange > new TimeSpan(GlobalData.PasswdExpirationPeriodDays, 0, 0, 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets users password. It then will be encrypted.
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
public virtual void SetPassword(string password)
|
||||
{
|
||||
this.Password = EncryptedPassword(password);
|
||||
Password3 = Password2;
|
||||
Password2 = Password;
|
||||
Password = EncryptedPassword(password);
|
||||
LastPwChange = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
public virtual string EncryptedPassword(string password)
|
||||
string EncryptedPassword(string password)
|
||||
{
|
||||
return getHash(password);
|
||||
}
|
||||
@ -154,8 +208,14 @@ namespace Users.Entities
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
/// <returns>true if password is correct</returns>
|
||||
public virtual bool CheckPassword(string password)
|
||||
public virtual bool IsCorrectPassword(string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(password) && string.IsNullOrEmpty(Password))
|
||||
{
|
||||
/// Currently saved and verified passwords are both empty => return true
|
||||
return true;
|
||||
}
|
||||
|
||||
return (Password == EncryptedPassword(password));
|
||||
}
|
||||
|
||||
@ -175,27 +235,20 @@ namespace Users.Entities
|
||||
{
|
||||
if (IsPowerUser(userName, password))
|
||||
{
|
||||
/// User is a power user => authorize
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("Power user '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (UserName.ToLower() == userName.ToLower())
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
{
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (UserName.ToLower() != userName.ToLower())
|
||||
{
|
||||
/// User name does not match => reject authorization
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -211,21 +264,13 @@ namespace Users.Entities
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeNumber(int number, string password, Grp.GID[] requiredGroupMembership)
|
||||
{
|
||||
if (Number == number)
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
{
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User ID={0} authorized @level '{1}'", number, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (Number != number)
|
||||
{
|
||||
/// User number does not match => reject authorization
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -241,22 +286,45 @@ namespace Users.Entities
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeFullName(string fullName, string password, Grp.GID[] requiredGroupMembership)
|
||||
{
|
||||
if (FullName.ToLower() == fullName.ToLower())
|
||||
if (FullName.ToLower() != fullName.ToLower())
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
/// Full number does not match => reject authorization
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verfy password, group membershit and password expiration time)
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="requiredGroupMembership">Required group membership</param>
|
||||
/// <returns>true = authorized</returns>
|
||||
bool CompleteAuthorization(string password, Grp.GID[] requiredGroupMembership)
|
||||
{
|
||||
if (!IsMemberOf(requiredGroupMembership) || !IsCorrectPassword(password))
|
||||
{
|
||||
/// Either group membership or password is not OK => reject authorization
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsPasswordExpired())
|
||||
{
|
||||
/// Password expired => User has to change the password
|
||||
if (new PasswordChangeDlg(UserName).ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
/// User did not change the password => reject authorization
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// All OK => complete authorization
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User alias={0} authorized @level '{1}'", fullName, requiredGroupMembership);
|
||||
log.FatalFormat("User '{0}' authorized @level '{1}'", UserName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Authorization method: 'requiredGroupMembership' contains a list of required groups.
|
||||
@ -270,10 +338,15 @@ namespace Users.Entities
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeTag(string tag, Grp.GID[] requiredGroupMembership)
|
||||
{
|
||||
if (Tag == tag)
|
||||
if (Tag != tag)
|
||||
{
|
||||
/// Tag number does not match => reject authorization
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsMemberOf(requiredGroupMembership))
|
||||
{
|
||||
/// Group membersip is OK _and_ password is OK => authorize
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User with Tag={0} authorized @level '{1}'", tag, requiredGroupMembership);
|
||||
@ -281,11 +354,10 @@ namespace Users.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Either group membership or password is not OK => reject authorization
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from a database.
|
||||
@ -316,8 +388,8 @@ namespace Users.Entities
|
||||
.CreateQuery("FROM User WHERE LOWER(UserName) = :username") /// Note: QueryOver<User>().Where(x => x.UserName.ToLower() == ... does not work
|
||||
.SetParameter("username", userName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -332,8 +404,8 @@ namespace Users.Entities
|
||||
.CreateQuery("FROM User WHERE LOWER(UserName) = :username") /// Note: QueryOver<User>().Where(x => x.UserName.ToLower() == ... does not work
|
||||
.SetParameter("username", userName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
|
||||
@ -352,8 +424,8 @@ namespace Users.Entities
|
||||
.CreateQuery("FROM User WHERE LOWER(Description) = :fullname") /// Note: QueryOver<User>().Where(x => x.FullName.ToLower() == ... does not work
|
||||
.SetParameter("fullname", fullName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -367,8 +439,8 @@ namespace Users.Entities
|
||||
.CreateQuery("FROM User WHERE LOWER(Description) = :fullname") /// Note: QueryOver<User>().Where(x => x.FullName.ToLower() == ... does not work
|
||||
.SetParameter("fullname", fullName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
|
||||
@ -387,8 +459,8 @@ namespace Users.Entities
|
||||
.QueryOver<User>()
|
||||
.Where(x => (x.Number == number))
|
||||
.List();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -402,8 +474,8 @@ namespace Users.Entities
|
||||
.QueryOver<User>()
|
||||
.Where(x => (x.Number == number))
|
||||
.List();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
|
||||
@ -422,8 +494,8 @@ namespace Users.Entities
|
||||
.QueryOver<User>()
|
||||
.Where(x => (x.Tag == tag))
|
||||
.List();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -437,8 +509,8 @@ namespace Users.Entities
|
||||
.QueryOver<User>()
|
||||
.Where(x => (x.Tag == tag))
|
||||
.List();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
|
||||
return (listOfUsers.Count > 0) ? listOfUsers[0] : null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
9
Users/Forms/EditSelectedUser.Designer.cs
generated
9
Users/Forms/EditSelectedUser.Designer.cs
generated
@ -50,6 +50,7 @@ namespace Users.Forms
|
||||
this.txtCode = new System.Windows.Forms.TextBox();
|
||||
this.tagLabel = new System.Windows.Forms.Label();
|
||||
this.txtTag = new System.Windows.Forms.TextBox();
|
||||
this.userHasToChangePasswdCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtName
|
||||
@ -147,10 +148,17 @@ namespace Users.Forms
|
||||
resources.ApplyResources(this.txtTag, "txtTag");
|
||||
this.txtTag.Name = "txtTag";
|
||||
//
|
||||
// userHasToChangePasswdCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.userHasToChangePasswdCheckBox, "userHasToChangePasswdCheckBox");
|
||||
this.userHasToChangePasswdCheckBox.Name = "userHasToChangePasswdCheckBox";
|
||||
this.userHasToChangePasswdCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EditSelectedUser
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.userHasToChangePasswdCheckBox);
|
||||
this.Controls.Add(this.tagLabel);
|
||||
this.Controls.Add(this.txtTag);
|
||||
this.Controls.Add(this.codeLabel);
|
||||
@ -198,5 +206,6 @@ namespace Users.Forms
|
||||
private System.Windows.Forms.TextBox txtCode;
|
||||
private System.Windows.Forms.Label tagLabel;
|
||||
private System.Windows.Forms.TextBox txtTag;
|
||||
private System.Windows.Forms.CheckBox userHasToChangePasswdCheckBox;
|
||||
}
|
||||
}
|
||||
@ -165,9 +165,27 @@ namespace Users.Forms
|
||||
|
||||
if (txtPassword.Text != string.Empty)
|
||||
{
|
||||
if (!userHasToChangePasswdCheckBox.Checked)
|
||||
{
|
||||
/// Password will not be changed, therefore it should meet requirements
|
||||
string explanation;
|
||||
if (!Entities.User.IsPasswordMeetsRequirements(txtPassword.Text, out explanation))
|
||||
{
|
||||
/// Password does not meet requirements
|
||||
MessageBox.Show(Strings.Password_does_not_meet_requirements + Environment.NewLine + explanation,
|
||||
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
user.SetPassword(txtPassword.Text);
|
||||
}
|
||||
|
||||
if (userHasToChangePasswdCheckBox.Checked)
|
||||
{
|
||||
user.LastPwChange = DateTime.MinValue;
|
||||
}
|
||||
|
||||
/// Groups
|
||||
IList<Group> groups = user.Groups; /// = session.QueryOver<Group>().Where(x => (x.User.Id == user.Id)).List();
|
||||
for (int gid = 0; gid < Grp.Count; gid++)
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>txtName.ZOrder" xml:space="preserve">
|
||||
<value>15</value>
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name="nameLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -165,14 +165,14 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>nameLabel.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
<value>13</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okBtn.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="okBtn.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 365</value>
|
||||
<value>137, 390</value>
|
||||
</data>
|
||||
<data name="okBtn.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>94, 31</value>
|
||||
@ -193,10 +193,10 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okBtn.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="cancelBtn.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>243, 365</value>
|
||||
<value>243, 390</value>
|
||||
</data>
|
||||
<data name="cancelBtn.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>94, 31</value>
|
||||
@ -217,7 +217,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cancelBtn.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="txtPassword.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 35</value>
|
||||
@ -241,7 +241,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>txtPassword.ZOrder" xml:space="preserve">
|
||||
<value>14</value>
|
||||
<value>15</value>
|
||||
</data>
|
||||
<data name="passwordLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -268,10 +268,10 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>passwordLabel.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="txtDescription.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 135</value>
|
||||
<value>137, 160</value>
|
||||
</data>
|
||||
<data name="txtDescription.Multiline" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -292,13 +292,13 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>txtDescription.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="descriptionLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="descriptionLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 138</value>
|
||||
<value>9, 163</value>
|
||||
</data>
|
||||
<data name="descriptionLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>60, 13</value>
|
||||
@ -319,10 +319,10 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>descriptionLabel.ZOrder" xml:space="preserve">
|
||||
<value>10</value>
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="checkedListBoxGroups.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 199</value>
|
||||
<value>137, 224</value>
|
||||
</data>
|
||||
<data name="checkedListBoxGroups.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>200, 154</value>
|
||||
@ -340,13 +340,13 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>checkedListBoxGroups.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="groupsLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="groupsLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 199</value>
|
||||
<value>9, 224</value>
|
||||
</data>
|
||||
<data name="groupsLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>41, 13</value>
|
||||
@ -367,7 +367,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupsLabel.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
<value>7</value>
|
||||
</data>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
@ -400,7 +400,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>repeatPasswordLabel.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="txtRepeatPassword.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 60</value>
|
||||
@ -424,7 +424,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>txtRepeatPassword.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="codeLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -433,7 +433,7 @@
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="codeLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 88</value>
|
||||
<value>9, 113</value>
|
||||
</data>
|
||||
<data name="codeLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>32, 13</value>
|
||||
@ -454,10 +454,10 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>codeLabel.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="txtCode.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 85</value>
|
||||
<value>137, 110</value>
|
||||
</data>
|
||||
<data name="txtCode.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>200, 20</value>
|
||||
@ -475,7 +475,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>txtCode.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="tagLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -484,7 +484,7 @@
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="tagLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 113</value>
|
||||
<value>9, 138</value>
|
||||
</data>
|
||||
<data name="tagLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>26, 13</value>
|
||||
@ -505,13 +505,13 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>tagLabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="txtTag.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="txtTag.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>137, 110</value>
|
||||
<value>137, 135</value>
|
||||
</data>
|
||||
<data name="txtTag.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>200, 20</value>
|
||||
@ -529,7 +529,34 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>txtTag.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="userHasToChangePasswdCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="userHasToChangePasswdCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>138, 87</value>
|
||||
</data>
|
||||
<data name="userHasToChangePasswdCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>188, 17</value>
|
||||
</data>
|
||||
<data name="userHasToChangePasswdCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>17</value>
|
||||
</data>
|
||||
<data name="userHasToChangePasswdCheckBox.Text" xml:space="preserve">
|
||||
<value>User has to change the password </value>
|
||||
</data>
|
||||
<data name=">>userHasToChangePasswdCheckBox.Name" xml:space="preserve">
|
||||
<value>userHasToChangePasswdCheckBox</value>
|
||||
</data>
|
||||
<data name=">>userHasToChangePasswdCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>userHasToChangePasswdCheckBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>userHasToChangePasswdCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
@ -538,7 +565,7 @@
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>375, 408</value>
|
||||
<value>375, 432</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Edit User</value>
|
||||
|
||||
147
Users/Forms/PasswordChangeDlg.Designer.cs
generated
Normal file
147
Users/Forms/PasswordChangeDlg.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace Users.Forms
|
||||
{
|
||||
partial class PasswordChangeDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PasswordChangeDlg));
|
||||
this.userNameLabel = new System.Windows.Forms.Label();
|
||||
this.oldPasswLabel = new System.Windows.Forms.Label();
|
||||
this.oldPasswTextBox = new System.Windows.Forms.TextBox();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.userNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.newPasswTextBox = new System.Windows.Forms.TextBox();
|
||||
this.newPasswVerifTextBox = new System.Windows.Forms.TextBox();
|
||||
this.newPasswLabel = new System.Windows.Forms.Label();
|
||||
this.newPasswVerifLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// userNameLabel
|
||||
//
|
||||
resources.ApplyResources(this.userNameLabel, "userNameLabel");
|
||||
this.userNameLabel.Name = "userNameLabel";
|
||||
//
|
||||
// oldPasswLabel
|
||||
//
|
||||
resources.ApplyResources(this.oldPasswLabel, "oldPasswLabel");
|
||||
this.oldPasswLabel.Name = "oldPasswLabel";
|
||||
//
|
||||
// oldPasswTextBox
|
||||
//
|
||||
resources.ApplyResources(this.oldPasswTextBox, "oldPasswTextBox");
|
||||
this.oldPasswTextBox.Name = "oldPasswTextBox";
|
||||
this.oldPasswTextBox.UseSystemPasswordChar = true;
|
||||
this.oldPasswTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.passwordTextBox_KeyPress);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
resources.ApplyResources(this.cancelButton, "cancelButton");
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// userNameTextBox
|
||||
//
|
||||
resources.ApplyResources(this.userNameTextBox, "userNameTextBox");
|
||||
this.userNameTextBox.Name = "userNameTextBox";
|
||||
this.userNameTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.userNameTextBox_KeyPress);
|
||||
//
|
||||
// newPasswTextBox
|
||||
//
|
||||
resources.ApplyResources(this.newPasswTextBox, "newPasswTextBox");
|
||||
this.newPasswTextBox.Name = "newPasswTextBox";
|
||||
this.newPasswTextBox.UseSystemPasswordChar = true;
|
||||
this.newPasswTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.newPasswTextBox_KeyPress);
|
||||
//
|
||||
// newPasswVerifTextBox
|
||||
//
|
||||
resources.ApplyResources(this.newPasswVerifTextBox, "newPasswVerifTextBox");
|
||||
this.newPasswVerifTextBox.Name = "newPasswVerifTextBox";
|
||||
this.newPasswVerifTextBox.UseSystemPasswordChar = true;
|
||||
this.newPasswVerifTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.newPasswVerifTextBox_KeyPress);
|
||||
//
|
||||
// newPasswLabel
|
||||
//
|
||||
resources.ApplyResources(this.newPasswLabel, "newPasswLabel");
|
||||
this.newPasswLabel.Name = "newPasswLabel";
|
||||
//
|
||||
// newPasswVerifLabel
|
||||
//
|
||||
resources.ApplyResources(this.newPasswVerifLabel, "newPasswVerifLabel");
|
||||
this.newPasswVerifLabel.Name = "newPasswVerifLabel";
|
||||
//
|
||||
// PasswordChangeDlg
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.Controls.Add(this.newPasswVerifLabel);
|
||||
this.Controls.Add(this.newPasswLabel);
|
||||
this.Controls.Add(this.newPasswVerifTextBox);
|
||||
this.Controls.Add(this.newPasswTextBox);
|
||||
this.Controls.Add(this.userNameTextBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.oldPasswTextBox);
|
||||
this.Controls.Add(this.oldPasswLabel);
|
||||
this.Controls.Add(this.userNameLabel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "PasswordChangeDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Load += new System.EventHandler(this.LoginDlg_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label userNameLabel;
|
||||
private System.Windows.Forms.Label oldPasswLabel;
|
||||
private System.Windows.Forms.TextBox userNameTextBox;
|
||||
private System.Windows.Forms.TextBox oldPasswTextBox;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.TextBox newPasswTextBox;
|
||||
private System.Windows.Forms.TextBox newPasswVerifTextBox;
|
||||
private System.Windows.Forms.Label newPasswLabel;
|
||||
private System.Windows.Forms.Label newPasswVerifLabel;
|
||||
}
|
||||
}
|
||||
187
Users/Forms/PasswordChangeDlg.cs
Normal file
187
Users/Forms/PasswordChangeDlg.cs
Normal file
@ -0,0 +1,187 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using GemCard;
|
||||
using Users.Resources;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Users.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides login dialog as well as user authorization using TBF.User.Authorize(...)
|
||||
/// (i.e. when DialogResult is OK, user was authorized).
|
||||
/// </summary>
|
||||
public partial class PasswordChangeDlg : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public PasswordChangeDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user.
|
||||
/// </summary>
|
||||
public PasswordChangeDlg(string predefinedUser)
|
||||
{
|
||||
InitializeComponent();
|
||||
userNameTextBox.Text = predefinedUser;
|
||||
}
|
||||
|
||||
|
||||
private void LoginDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
if (string.IsNullOrEmpty(userNameTextBox.Text))
|
||||
{
|
||||
userNameTextBox.Enabled = true;
|
||||
userNameTextBox.Select();
|
||||
}
|
||||
else
|
||||
{
|
||||
oldPasswTextBox.Select();
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Change_your_password_please;
|
||||
userNameLabel.Text = Strings.User_name;
|
||||
oldPasswLabel.Text = Strings.Old_password;
|
||||
newPasswLabel.Text = Strings.New_password;
|
||||
newPasswVerifLabel.Text = Strings.New_password_verification;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to authorize the user when OK clicked.
|
||||
/// </summary>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string userName = userNameTextBox.Text;
|
||||
string oldPassword = oldPasswTextBox.Text;
|
||||
|
||||
if (Entities.User.IsPowerUser(userName, oldPassword))
|
||||
{
|
||||
MessageBox.Show(Strings.Power_user_cannot_change_its_password, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
string explanation;
|
||||
if (newPasswTextBox.Text != newPasswVerifTextBox.Text)
|
||||
{
|
||||
MessageBox.Show(Strings.New_password_and_its_verification_are_different, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
DialogResult = DialogResult.None;
|
||||
return;
|
||||
}
|
||||
else if (!Entities.User.IsPasswordMeetsRequirements(newPasswTextBox.Text, out explanation))
|
||||
{
|
||||
MessageBox.Show(Strings.Password_does_not_meet_requirements + Environment.NewLine + explanation,
|
||||
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
DialogResult = DialogResult.None;
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.AuthorizedAs authorizedAs = Entities.AuthorizedAs.RemoteUser;
|
||||
Users.Entities.User loadedUser = null;
|
||||
///
|
||||
bool oldPasswdOK = false;
|
||||
if (!oldPasswdOK)
|
||||
{
|
||||
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB };
|
||||
|
||||
foreach (var db in dbs)
|
||||
{
|
||||
try
|
||||
{
|
||||
loadedUser = Users.Entities.User.LoadUserByName(userName, db);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
oldPasswdOK = (userName == loadedUser.UserName) && loadedUser.IsCorrectPassword(oldPassword);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
if (oldPasswdOK) break;
|
||||
|
||||
authorizedAs = Entities.AuthorizedAs.LocalUser;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldPasswdOK && (DB.CurrentSession != null) && (DB.CurrentSession.IsOpen))
|
||||
{
|
||||
if (loadedUser.IsPasswordUsedInPast(newPasswTextBox.Text))
|
||||
{
|
||||
MessageBox.Show(Strings.Password_has_been_used_in_past, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
DialogResult = DialogResult.None;
|
||||
return;
|
||||
}
|
||||
|
||||
///
|
||||
/// Now the password is changed in database that was used to authorize the user
|
||||
///
|
||||
loadedUser.SetPassword(newPasswTextBox.Text);
|
||||
DB.CurrentSession.SaveOrUpdate(loadedUser);
|
||||
DB.CurrentSession.Flush();
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
MessageBox.Show(Strings.Invalid_username_or_password, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
DialogResult = DialogResult.None;
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel clicked, do not try to authorize.
|
||||
/// </summary>
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
private void userNameTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (Convert.ToInt32(e.KeyChar) == 13)
|
||||
{
|
||||
oldPasswTextBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void passwordTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (Convert.ToInt32(e.KeyChar) == 13)
|
||||
{
|
||||
newPasswTextBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void newPasswTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (Convert.ToInt32(e.KeyChar) == 13)
|
||||
{
|
||||
newPasswVerifTextBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void newPasswVerifTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (Convert.ToInt32(e.KeyChar) == 13)
|
||||
{
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
411
Users/Forms/PasswordChangeDlg.resx
Normal file
411
Users/Forms/PasswordChangeDlg.resx
Normal file
@ -0,0 +1,411 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="userNameLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="userNameLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>11, 24</value>
|
||||
</data>
|
||||
<data name="userNameLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>58, 13</value>
|
||||
</data>
|
||||
<data name="userNameLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="userNameLabel.Text" xml:space="preserve">
|
||||
<value>User name</value>
|
||||
</data>
|
||||
<data name=">>userNameLabel.Name" xml:space="preserve">
|
||||
<value>userNameLabel</value>
|
||||
</data>
|
||||
<data name=">>userNameLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>userNameLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>userNameLabel.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="oldPasswLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="oldPasswLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>11, 51</value>
|
||||
</data>
|
||||
<data name="oldPasswLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>71, 13</value>
|
||||
</data>
|
||||
<data name="oldPasswLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="oldPasswLabel.Text" xml:space="preserve">
|
||||
<value>Old password</value>
|
||||
</data>
|
||||
<data name=">>oldPasswLabel.Name" xml:space="preserve">
|
||||
<value>oldPasswLabel</value>
|
||||
</data>
|
||||
<data name=">>oldPasswLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>oldPasswLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>oldPasswLabel.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="oldPasswTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="oldPasswTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>150, 48</value>
|
||||
</data>
|
||||
<data name="oldPasswTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 20</value>
|
||||
</data>
|
||||
<data name="oldPasswTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name=">>oldPasswTextBox.Name" xml:space="preserve">
|
||||
<value>oldPasswTextBox</value>
|
||||
</data>
|
||||
<data name=">>oldPasswTextBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>oldPasswTextBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>oldPasswTextBox.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="cancelButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>336, 48</value>
|
||||
</data>
|
||||
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>105, 28</value>
|
||||
</data>
|
||||
<data name="cancelButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="cancelButton.Text" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.Name" xml:space="preserve">
|
||||
<value>cancelButton</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cancelButton.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>336, 14</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>105, 28</value>
|
||||
</data>
|
||||
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name=">>okButton.Name" xml:space="preserve">
|
||||
<value>okButton</value>
|
||||
</data>
|
||||
<data name=">>okButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>okButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="userNameTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="userNameTextBox.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="userNameTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>150, 22</value>
|
||||
</data>
|
||||
<data name="userNameTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 20</value>
|
||||
</data>
|
||||
<data name="userNameTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>userNameTextBox.Name" xml:space="preserve">
|
||||
<value>userNameTextBox</value>
|
||||
</data>
|
||||
<data name=">>userNameTextBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>userNameTextBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>userNameTextBox.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="newPasswTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="newPasswTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>150, 74</value>
|
||||
</data>
|
||||
<data name="newPasswTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 20</value>
|
||||
</data>
|
||||
<data name="newPasswTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name=">>newPasswTextBox.Name" xml:space="preserve">
|
||||
<value>newPasswTextBox</value>
|
||||
</data>
|
||||
<data name=">>newPasswTextBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>newPasswTextBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>newPasswTextBox.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="newPasswVerifTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="newPasswVerifTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>150, 100</value>
|
||||
</data>
|
||||
<data name="newPasswVerifTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 20</value>
|
||||
</data>
|
||||
<data name="newPasswVerifTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifTextBox.Name" xml:space="preserve">
|
||||
<value>newPasswVerifTextBox</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifTextBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifTextBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifTextBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="newPasswLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="newPasswLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="newPasswLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>11, 77</value>
|
||||
</data>
|
||||
<data name="newPasswLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>77, 13</value>
|
||||
</data>
|
||||
<data name="newPasswLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="newPasswLabel.Text" xml:space="preserve">
|
||||
<value>New password</value>
|
||||
</data>
|
||||
<data name=">>newPasswLabel.Name" xml:space="preserve">
|
||||
<value>newPasswLabel</value>
|
||||
</data>
|
||||
<data name=">>newPasswLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>newPasswLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>newPasswLabel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="newPasswVerifLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="newPasswVerifLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="newPasswVerifLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 103</value>
|
||||
</data>
|
||||
<data name="newPasswVerifLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>77, 13</value>
|
||||
</data>
|
||||
<data name="newPasswVerifLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="newPasswVerifLabel.Text" xml:space="preserve">
|
||||
<value>New password</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifLabel.Name" xml:space="preserve">
|
||||
<value>newPasswVerifLabel</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>newPasswVerifLabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>456, 134</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterScreen</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Password change</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>PasswordChangeDlg</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -11,6 +11,9 @@ namespace Users
|
||||
public static Entities.AuthorizedAs AuthorizedAs;
|
||||
public static DateTime LastAuthorization = DateTime.Now;
|
||||
|
||||
public static int MinPasswdLength = 0;
|
||||
public static int PasswdExpirationPeriodDays = 0;
|
||||
|
||||
public static string GetCurrentUserName()
|
||||
{
|
||||
return (CurrentUser != null) ? CurrentUser.UserName : string.Empty;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
|
||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.1302.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1302.0")]
|
||||
[assembly: AssemblyVersion("2.18.1313.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1313.0")]
|
||||
|
||||
81
Users/Resources/Strings.Designer.cs
generated
81
Users/Resources/Strings.Designer.cs
generated
@ -105,6 +105,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Change your password please.
|
||||
/// </summary>
|
||||
internal static string Change_your_password_please {
|
||||
get {
|
||||
return ResourceManager.GetString("Change_your_password_please", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Close.
|
||||
/// </summary>
|
||||
@ -276,6 +285,33 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New password.
|
||||
/// </summary>
|
||||
internal static string New_password {
|
||||
get {
|
||||
return ResourceManager.GetString("New_password", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New password and it's verification are different.
|
||||
/// </summary>
|
||||
internal static string New_password_and_its_verification_are_different {
|
||||
get {
|
||||
return ResourceManager.GetString("New_password_and_its_verification_are_different", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New password verification.
|
||||
/// </summary>
|
||||
internal static string New_password_verification {
|
||||
get {
|
||||
return ResourceManager.GetString("New_password_verification", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No remote database of users.
|
||||
/// </summary>
|
||||
@ -294,6 +330,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Old password.
|
||||
/// </summary>
|
||||
internal static string Old_password {
|
||||
get {
|
||||
return ResourceManager.GetString("Old_password", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password.
|
||||
/// </summary>
|
||||
@ -303,6 +348,42 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password does not meet requirements.
|
||||
/// </summary>
|
||||
internal static string Password_does_not_meet_requirements {
|
||||
get {
|
||||
return ResourceManager.GetString("Password_does_not_meet_requirements", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password has been used in the past.
|
||||
/// </summary>
|
||||
internal static string Password_has_been_used_in_past {
|
||||
get {
|
||||
return ResourceManager.GetString("Password_has_been_used_in_past", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password must have at least {0} characters.
|
||||
/// </summary>
|
||||
internal static string Password_must_have_at_least_0_characters {
|
||||
get {
|
||||
return ResourceManager.GetString("Password_must_have_at_least_0_characters", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Power user cannot change it's password.
|
||||
/// </summary>
|
||||
internal static string Power_user_cannot_change_its_password {
|
||||
get {
|
||||
return ResourceManager.GetString("Power_user_cannot_change_its_password", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to production tracing administrator.
|
||||
/// </summary>
|
||||
|
||||
@ -222,4 +222,31 @@
|
||||
<data name="production_tracing_administrator" xml:space="preserve">
|
||||
<value>správce sledování výroby</value>
|
||||
</data>
|
||||
<data name="Change_your_password_please" xml:space="preserve">
|
||||
<value>Změňte svoje heslo prosím</value>
|
||||
</data>
|
||||
<data name="New_password" xml:space="preserve">
|
||||
<value>Nové heslo</value>
|
||||
</data>
|
||||
<data name="New_password_verification" xml:space="preserve">
|
||||
<value>Verifikace nového hesla</value>
|
||||
</data>
|
||||
<data name="Old_password" xml:space="preserve">
|
||||
<value>Staré heslo</value>
|
||||
</data>
|
||||
<data name="New_password_and_its_verification_are_different" xml:space="preserve">
|
||||
<value>Nové heslo a jeho verifikace jsou různé</value>
|
||||
</data>
|
||||
<data name="Password_does_not_meet_requirements" xml:space="preserve">
|
||||
<value>Heslo nesplňuje požadavky</value>
|
||||
</data>
|
||||
<data name="Password_has_been_used_in_past" xml:space="preserve">
|
||||
<value>Heslo už bylo v minulosti použito</value>
|
||||
</data>
|
||||
<data name="Power_user_cannot_change_its_password" xml:space="preserve">
|
||||
<value>Power uživatel nemůže změnit heslo</value>
|
||||
</data>
|
||||
<data name="Password_must_have_at_least_0_characters" xml:space="preserve">
|
||||
<value>Heslo musí mít nejméně {0} znaků</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -243,4 +243,31 @@
|
||||
<data name="water_meter_authority" xml:space="preserve">
|
||||
<value>water meter authority</value>
|
||||
</data>
|
||||
<data name="Change_your_password_please" xml:space="preserve">
|
||||
<value>Change your password please</value>
|
||||
</data>
|
||||
<data name="New_password" xml:space="preserve">
|
||||
<value>New password</value>
|
||||
</data>
|
||||
<data name="New_password_verification" xml:space="preserve">
|
||||
<value>New password verification</value>
|
||||
</data>
|
||||
<data name="Old_password" xml:space="preserve">
|
||||
<value>Old password</value>
|
||||
</data>
|
||||
<data name="New_password_and_its_verification_are_different" xml:space="preserve">
|
||||
<value>New password and it's verification are different</value>
|
||||
</data>
|
||||
<data name="Password_does_not_meet_requirements" xml:space="preserve">
|
||||
<value>Password does not meet requirements</value>
|
||||
</data>
|
||||
<data name="Password_has_been_used_in_past" xml:space="preserve">
|
||||
<value>Password has been used in the past</value>
|
||||
</data>
|
||||
<data name="Power_user_cannot_change_its_password" xml:space="preserve">
|
||||
<value>Power user cannot change it's password</value>
|
||||
</data>
|
||||
<data name="Password_must_have_at_least_0_characters" xml:space="preserve">
|
||||
<value>Password must have at least {0} characters</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -62,6 +62,12 @@
|
||||
<Compile Include="Forms\LviNameSurnameColumnComparer.cs" />
|
||||
<Compile Include="Forms\LviIntColumnComparer.cs" />
|
||||
<Compile Include="Forms\LviTextColumnComparer.cs" />
|
||||
<Compile Include="Forms\PasswordChangeDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\PasswordChangeDlg.designer.cs">
|
||||
<DependentUpon>PasswordChangeDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalData.cs" />
|
||||
<Compile Include="DB.cs" />
|
||||
<Compile Include="Entities\Enums.cs" />
|
||||
@ -105,6 +111,9 @@
|
||||
<EmbeddedResource Include="Forms\EditSelectedUser.resx">
|
||||
<DependentUpon>EditSelectedUser.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\PasswordChangeDlg.resx">
|
||||
<DependentUpon>PasswordChangeDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\UserManagementDlg.resx">
|
||||
<DependentUpon>UserManagementDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user