示例#1
0
        public void ChangePassword(IConnectToDB _Connect, Guid?uuid, string password)
        {
            _DynamicOutputProcedures DynamicOutput        = new _DynamicOutputProcedures();
            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();
            ER_Sec er_sec  = new ER_Sec();
            add    addHelp = new add();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "IDENTITIES_UUID_", DBType = SqlDbType.UniqueIdentifier, ParamValue = uuid
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__ID_PASSWORD_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                columns = "ID_PASSWORD_ID,RENDITION,IDENTITIES_ID", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            DataColumnCollection _dccColumnID = TempDataTable.Columns;

            if (_dccColumnID.Contains("ID_PASSWORD_ID") && TempDataTable.Rows.Count > 0)
            {
                //Update Password
                Values.UpdateIDPassword IDPasswordModel = null;
                string hash = ER_Sec.ComputeHash(password, "SHA512", null);
                IDPasswordModel = addHelp.UPDATE_ENTRY_Identities_Password(_Connect, new Values.UpdateIDPassword
                {
                    I_ID_PASSWORD_ID = TempDataTable.Rows[0].Field <long?>("ID_PASSWORD_ID"),
                    I_OBJECT_TYPE    = "Password",
                    I_RENDITION      = TempDataTable.Rows[0].Field <long?>("RENDITION"),
                    I_PASSWORD       = er_sec.EncryptStringToBytes_Aes(hash, er_sec.GetCryptPairforID(_Connect, TempDataTable.Rows[0].Field <long?>("IDENTITIES_ID"), new ER_CRYPT_PAIR()))
                });
            }
        }
示例#2
0
        public void ResetPassword(IConnectToDB _Connect, string VerifyUUID, string password)
        {
            ER_Sec er_sec = new ER_Sec();
            ER_DML er_dml = new ER_DML();

            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> verifyIdentityFilters = new List <DynamicModels.RootReportFilter>();
            List <DynamicModels.RootReportFilter> idPasswordFilters     = new List <DynamicModels.RootReportFilter>();

            verifyIdentityFilters.Add(new DynamicModels.RootReportFilter {
                FilterName = "UUID_", DBType = SqlDbType.VarChar, ParamValue = VerifyUUID
            });

            DataTable verifyIdentityTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__VERIFY_SEARCH",
                                                                         new DataTableDotNetModelMetaData {
                columns = "IDENTITIES_ID", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                         verifyIdentityFilters);

            idPasswordFilters.Add(new DynamicModels.RootReportFilter {
                FilterName = "Identities_ID_", DBType = SqlDbType.BigInt, ParamValue = verifyIdentityTable.Rows[0].Field <long?>("IDENTITIES_ID")
            });

            DataTable idPasswordTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__ID_PASSWORD_SEARCH",
                                                                     new DataTableDotNetModelMetaData {
                columns = "ID_PASSWORD_ID", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                     idPasswordFilters);

            //Update Password
            string hash = ER_Sec.ComputeHash(password, "SHA512", null);

            er_dml.OBJECT_DML(_Connect, "Update", "ID_PASSWORD", "PASSWORD", idPasswordTable.Rows[0].Field <long?>("ID_PASSWORD_ID"),
                              new Object_Value
            {
                _File = new File_Object
                {
                    _FileBytes = er_sec.EncryptStringToBytes_Aes(hash,
                                                                 er_sec.GetCryptPairforID(_Connect, verifyIdentityTable.Rows[0].Field <long?>("IDENTITIES_ID"), new ER_CRYPT_PAIR()))
                }
            });

            //disable verification
            VerificationHelper VH = new VerificationHelper();

            VH.DisableVerificationsForID(_Connect, verifyIdentityTable.Rows[0].Field <long?>("IDENTITIES_ID"), "ResetPassword");
        }