QER.CompositionApi/QER.CompositionApi.Password/PasscodeGenerator.cs
Decompiler Source FileQER.CompositionApi.PasscodeGeneratorDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- CallFunctionAsync: CreatePassCode at line 263
- CallFunctionAsync: CreatePassCode at line 445
Typed Edges
- No typed edges extracted for this source.
References
- No direct source references extracted.
Referenced By
- No direct source references extracted.
C# source-derived context
Generated by pattern extraction from the decompiled C# source and decompile index. This is factual source evidence, not inferred behavior.
reads entity values references DB/Dialog objects
Summary: classes PasscodeGenerator; methods MoveNext, SetStateMachine, FindManager, CreatePasscodeAsync; references ESet, Person; markers reads entity values, references DB/Dialog objects
Classes
PasscodeGeneratorOIM key/entity markers
UID_Person XObjectKey UID_PersonHead UID_PersonManagerAPI/entity calls
GetValue SqlFormatter From Source Config GetLogSession StartUnitOfWork UserRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Diagnostics;5using System.Runtime.CompilerServices;6using System.Runtime.InteropServices;7using System.Threading;8using System.Threading.Tasks;9using QBM.CompositionApi;10using VI.Base;11using VI.DB;12using VI.DB.Entities;13using VI.DB.JobGeneration;1415namespace QER.CompositionApi.Password;1617public class PasscodeGenerator18{19 [StructLayout((LayoutKind)3)]20 [CompilerGenerated]21 private struct _003CCreatePasscodeAsync_003Ed__1 : IAsyncStateMachine22 {23 public int _003C_003E1__state;2425 public AsyncTaskMethodBuilder<PersonPasscodeResult> _003C_003Et__builder;2627 public ISession session;2829 public string uid;3031 public CancellationToken ct;3233 public int hoursValid;3435 private ISqlFormatter _003Csqlf_003E5__2;3637 private IEntity _003Cperson_003E5__3;3839 private string _003Cpasscode_003E5__4;4041 private bool _003Cpasscodesplit_003E5__5;4243 private string _003CuidPersonmanager_003E5__6;4445 private IConnection _003Cconnection_003E5__7;4647 private string _003CfirstPart_003E5__8;4849 private string _003Csecondpart_003E5__9;5051 private ConfiguredTaskAwaiter<IEntity> _003C_003Eu__1;5253 private ConfiguredValueTaskAwaiter<object> _003C_003Eu__2;5455 private IUnitOfWork _003Cu_003E5__10;5657 private ConfiguredTaskAwaiter _003C_003Eu__3;5859 private ConfiguredTaskAwaiter<string> _003C_003Eu__4;6061 private void MoveNext()62 {63 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)64 //IL_00c4: Unknown result type (might be due to invalid IL or missing references)65 //IL_00cc: Unknown result type (might be due to invalid IL or missing references)66 //IL_014b: Unknown result type (might be due to invalid IL or missing references)67 //IL_0150: Unknown result type (might be due to invalid IL or missing references)68 //IL_0158: Unknown result type (might be due to invalid IL or missing references)69 //IL_0325: Unknown result type (might be due to invalid IL or missing references)70 //IL_032a: Unknown result type (might be due to invalid IL or missing references)71 //IL_0332: Unknown result type (might be due to invalid IL or missing references)72 //IL_0405: Unknown result type (might be due to invalid IL or missing references)73 //IL_040a: Unknown result type (might be due to invalid IL or missing references)74 //IL_0412: Unknown result type (might be due to invalid IL or missing references)75 //IL_0076: Unknown result type (might be due to invalid IL or missing references)76 //IL_0081: Unknown result type (might be due to invalid IL or missing references)77 //IL_0086: Unknown result type (might be due to invalid IL or missing references)78 //IL_008a: Unknown result type (might be due to invalid IL or missing references)79 //IL_008f: Unknown result type (might be due to invalid IL or missing references)80 //IL_00fe: Unknown result type (might be due to invalid IL or missing references)81 //IL_010d: Unknown result type (might be due to invalid IL or missing references)82 //IL_0112: Unknown result type (might be due to invalid IL or missing references)83 //IL_0116: Unknown result type (might be due to invalid IL or missing references)84 //IL_011b: Unknown result type (might be due to invalid IL or missing references)85 //IL_00a4: Unknown result type (might be due to invalid IL or missing references)86 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)87 //IL_0130: Unknown result type (might be due to invalid IL or missing references)88 //IL_0132: Unknown result type (might be due to invalid IL or missing references)89 //IL_01f1: Unknown result type (might be due to invalid IL or missing references)90 //IL_01f6: Unknown result type (might be due to invalid IL or missing references)91 //IL_01fe: Unknown result type (might be due to invalid IL or missing references)92 //IL_03bc: Unknown result type (might be due to invalid IL or missing references)93 //IL_03c7: Unknown result type (might be due to invalid IL or missing references)94 //IL_03cc: Unknown result type (might be due to invalid IL or missing references)95 //IL_03d0: Unknown result type (might be due to invalid IL or missing references)96 //IL_03d5: Unknown result type (might be due to invalid IL or missing references)97 //IL_021b: Unknown result type (might be due to invalid IL or missing references)98 //IL_0226: Unknown result type (might be due to invalid IL or missing references)99 //IL_022b: Unknown result type (might be due to invalid IL or missing references)100 //IL_022f: Unknown result type (might be due to invalid IL or missing references)101 //IL_0234: Unknown result type (might be due to invalid IL or missing references)102 //IL_0264: Unknown result type (might be due to invalid IL or missing references)103 //IL_0269: Unknown result type (might be due to invalid IL or missing references)104 //IL_0271: Unknown result type (might be due to invalid IL or missing references)105 //IL_01a8: Unknown result type (might be due to invalid IL or missing references)106 //IL_01b3: Unknown result type (might be due to invalid IL or missing references)107 //IL_01b8: Unknown result type (might be due to invalid IL or missing references)108 //IL_01bc: Unknown result type (might be due to invalid IL or missing references)109 //IL_01c1: Unknown result type (might be due to invalid IL or missing references)110 //IL_03ea: Unknown result type (might be due to invalid IL or missing references)111 //IL_03ec: Unknown result type (might be due to invalid IL or missing references)112 //IL_0249: Unknown result type (might be due to invalid IL or missing references)113 //IL_024b: Unknown result type (might be due to invalid IL or missing references)114 //IL_01d6: Unknown result type (might be due to invalid IL or missing references)115 //IL_01d8: Unknown result type (might be due to invalid IL or missing references)116 //IL_02dc: Unknown result type (might be due to invalid IL or missing references)117 //IL_02e7: Unknown result type (might be due to invalid IL or missing references)118 //IL_02ec: Unknown result type (might be due to invalid IL or missing references)119 //IL_02f0: Unknown result type (might be due to invalid IL or missing references)120 //IL_02f5: Unknown result type (might be due to invalid IL or missing references)121 //IL_030a: Unknown result type (might be due to invalid IL or missing references)122 //IL_030c: Unknown result type (might be due to invalid IL or missing references)123 int num = _003C_003E1__state;124 PersonPasscodeResult result5;125 try126 {127 ConfiguredTaskAwaiter<IEntity> val3;128 ConfiguredValueTaskAwaiter<object> val2;129 ConfiguredTaskAwaiter<string> val;130 string result;131 int num2;132 IEntity result2;133 string result3;134 object result4;135 switch (num)136 {137 default:138 {139 _003Csqlf_003E5__2 = session.SqlFormatter();140 string whereClause = _003Csqlf_003E5__2.UidComparison("UID_Person", uid);141 Query query = Query.From("Person").SelectAll().Where(whereClause);142 val3 = session.Source().GetAsync(query, EntityLoadType.Interactive, ct).ConfigureAwait(false)143 .GetAwaiter();144 if (!val3.IsCompleted)145 {146 num = (_003C_003E1__state = 0);147 _003C_003Eu__1 = val3;148 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity>, _003CCreatePasscodeAsync_003Ed__1>(ref val3, ref this);149 return;150 }151 goto IL_00db;152 }153 case 0:154 val3 = _003C_003Eu__1;155 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity>);156 num = (_003C_003E1__state = -1);157 goto IL_00db;158 case 1:159 val2 = _003C_003Eu__2;160 _003C_003Eu__2 = default(ConfiguredValueTaskAwaiter<object>);161 num = (_003C_003E1__state = -1);162 goto IL_0167;163 case 2:164 case 3:165 try166 {167 ConfiguredTaskAwaiter val4;168 ConfiguredTaskAwaitable val5;169 if (num != 2)170 {171 if (num == 3)172 {173 val4 = _003C_003Eu__3;174 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);175 num = (_003C_003E1__state = -1);176 goto IL_0280;177 }178 val5 = _003Cu_003E5__10.PutAsync(_003Cperson_003E5__3, ct).ConfigureAwait(false);179 val4 = ((ConfiguredTaskAwaitable)(ref val5)).GetAwaiter();180 if (!((ConfiguredTaskAwaiter)(ref val4)).IsCompleted)181 {182 num = (_003C_003E1__state = 2);183 _003C_003Eu__3 = val4;184 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCreatePasscodeAsync_003Ed__1>(ref val4, ref this);185 return;186 }187 }188 else189 {190 val4 = _003C_003Eu__3;191 _003C_003Eu__3 = default(ConfiguredTaskAwaiter);192 num = (_003C_003E1__state = -1);193 }194 ((ConfiguredTaskAwaiter)(ref val4)).GetResult();195 val5 = _003Cu_003E5__10.CommitAsync(ct).ConfigureAwait(false);196 val4 = ((ConfiguredTaskAwaitable)(ref val5)).GetAwaiter();197 if (!((ConfiguredTaskAwaiter)(ref val4)).IsCompleted)198 {199 num = (_003C_003E1__state = 3);200 _003C_003Eu__3 = val4;201 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003CCreatePasscodeAsync_003Ed__1>(ref val4, ref this);202 return;203 }204 goto IL_0280;205 IL_0280:206 ((ConfiguredTaskAwaiter)(ref val4)).GetResult();207 }208 finally209 {210 if (num < 0 && _003Cu_003E5__10 != null)211 {212 ((System.IDisposable)_003Cu_003E5__10).Dispose();213 }214 }215 _003Cu_003E5__10 = null;216 _003Cpasscodesplit_003E5__5 = false;217 _003CuidPersonmanager_003E5__6 = "";218 _003Cconnection_003E5__7 = session.Resolve<IConnection>();219 val = session.Config().GetConfigParmAsync("QER\\Person\\PasswordResetAuthenticator\\PasscodeSplit", ct).ConfigureAwait(false)220 .GetAwaiter();221 if (!val.IsCompleted)222 {223 num = (_003C_003E1__state = 4);224 _003C_003Eu__4 = val;225 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, _003CCreatePasscodeAsync_003Ed__1>(ref val, ref this);226 return;227 }228 goto IL_0341;229 case 4:230 val = _003C_003Eu__4;231 _003C_003Eu__4 = default(ConfiguredTaskAwaiter<string>);232 num = (_003C_003E1__state = -1);233 goto IL_0341;234 case 5:235 {236 val = _003C_003Eu__4;237 _003C_003Eu__4 = default(ConfiguredTaskAwaiter<string>);238 num = (_003C_003E1__state = -1);239 goto IL_0421;240 }241 IL_0341:242 result = val.GetResult();243 num2 = _003Cpasscode_003E5__4.Length / 2;244 _003CfirstPart_003E5__8 = _003Cpasscode_003E5__4.Substring(0, num2);245 _003Csecondpart_003E5__9 = _003Cpasscode_003E5__4.Substring(num2);246 if (!result.Equals("1"))247 {248 break;249 }250 _003Cpasscodesplit_003E5__5 = true;251 val = FindManager(string.Format("UID_Person in (select uid_personhead from person where {0})", (object)_003Csqlf_003E5__2.UidComparison("UID_Person", uid)), session, ct).ConfigureAwait(false).GetAwaiter();252 if (!val.IsCompleted)253 {254 num = (_003C_003E1__state = 5);255 _003C_003Eu__4 = val;256 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, _003CCreatePasscodeAsync_003Ed__1>(ref val, ref this);257 return;258 }259 goto IL_0421;260 IL_00db:261 result2 = val3.GetResult();262 _003Cperson_003E5__3 = result2;263 val2 = _003Cperson_003E5__3.CallFunctionAsync("CreatePassCode", hoursValid, ct).ConfigureAwait(false).GetAwaiter();264 if (!val2.IsCompleted)265 {266 num = (_003C_003E1__state = 1);267 _003C_003Eu__2 = val2;268 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<object>, _003CCreatePasscodeAsync_003Ed__1>(ref val2, ref this);269 return;270 }271 goto IL_0167;272 IL_0421:273 result3 = val.GetResult();274 _003CuidPersonmanager_003E5__6 = result3;275 if (!string.IsNullOrEmpty(_003CuidPersonmanager_003E5__6))276 {277 DbObjectKey dbObjectKey = new DbObjectKey(_003Cperson_003E5__3.GetValue("XObjectKey"));278 JobGen.Generate(parameters: (IDictionary)(object)new Dictionary<string, string>279 {280 ["UID_PersonHead"] = _003CuidPersonmanager_003E5__6,281 ["PassCode"] = _003Csecondpart_003E5__9282 }, baseObject: dbObjectKey.GetObject(_003Cconnection_003E5__7), eventname: "SEND_PASSCODE_TO_MANAGER");283 session.GetLogSession().Debug("PasscodeSplit: sending passcode portion to manager {0} found for {1}", _003CuidPersonmanager_003E5__6, uid);284 }285 else286 {287 session.GetLogSession().Debug("PasscodeSplit: split is not possible because no manager found for {0}", uid);288 _003Cpasscodesplit_003E5__5 = false;289 }290 break;291 IL_0167:292 result4 = val2.GetResult();293 _003Cpasscode_003E5__4 = (string)result4;294 _003Cu_003E5__10 = session.StartUnitOfWork();295 goto case 2;296 }297 if (_003Cpasscodesplit_003E5__5)298 {299 _003Cpasscode_003E5__4 = _003CfirstPart_003E5__8;300 }301 result5 = new PersonPasscodeResult302 {303 PassCode = _003Cpasscode_003E5__4,304 PasscodeSplit = _003Cpasscodesplit_003E5__5,305 HoursValid = hoursValid,306 UID_PersonManager = _003CuidPersonmanager_003E5__6307 };308 }309 catch (System.Exception exception)310 {311 _003C_003E1__state = -2;312 _003Csqlf_003E5__2 = null;313 _003Cperson_003E5__3 = null;314 _003Cpasscode_003E5__4 = null;315 _003CuidPersonmanager_003E5__6 = null;316 _003Cconnection_003E5__7 = null;317 _003CfirstPart_003E5__8 = null;318 _003Csecondpart_003E5__9 = null;319 _003C_003Et__builder.SetException(exception);320 return;321 }322 _003C_003E1__state = -2;323 _003Csqlf_003E5__2 = null;324 _003Cperson_003E5__3 = null;325 _003Cpasscode_003E5__4 = null;326 _003CuidPersonmanager_003E5__6 = null;327 _003Cconnection_003E5__7 = null;328 _003CfirstPart_003E5__8 = null;329 _003Csecondpart_003E5__9 = null;330 _003C_003Et__builder.SetResult(result5);331 }332333 [DebuggerHidden]334 private void SetStateMachine(IAsyncStateMachine stateMachine)335 {336 _003C_003Et__builder.SetStateMachine(stateMachine);337 }338 }339340 [StructLayout((LayoutKind)3)]341 [CompilerGenerated]342 private struct _003CFindManager_003Ed__0 : IAsyncStateMachine343 {344 public int _003C_003E1__state;345346 public AsyncTaskMethodBuilder<string> _003C_003Et__builder;347348 public ISession session;349350 public string where;351352 public CancellationToken ct;353354 private ConfiguredTaskAwaiter<IEntityCollection> _003C_003Eu__1;355356 private void MoveNext()357 {358 //IL_00f5: Unknown result type (might be due to invalid IL or missing references)359 //IL_00fa: Unknown result type (might be due to invalid IL or missing references)360 //IL_0102: Unknown result type (might be due to invalid IL or missing references)361 //IL_00af: Unknown result type (might be due to invalid IL or missing references)362 //IL_00ba: Unknown result type (might be due to invalid IL or missing references)363 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)364 //IL_00c3: Unknown result type (might be due to invalid IL or missing references)365 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)366 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)367 //IL_00df: Unknown result type (might be due to invalid IL or missing references)368 int num = _003C_003E1__state;369 string result2;370 try371 {372 ConfiguredTaskAwaiter<IEntityCollection> val;373 if (num != 0)374 {375 ISqlFormatter sqlFormatter = session.SqlFormatter();376 string uid = session.User().Uid;377 Query query = Query.From("Person").Select("UID_Person").Where(where)378 .Where(sqlFormatter.UidComparison("UID_Person", uid, CompareOperator.NotEqual))379 .Where("isinactive = 0")380 .Where(" not(" + sqlFormatter.EmptyClause("DefaultEMailAddress", ValType.String) + ")");381 val = session.Source().GetCollectionAsync(query, EntityCollectionLoadType.Default, ct).ConfigureAwait(false)382 .GetAwaiter();383 if (!val.IsCompleted)384 {385 num = (_003C_003E1__state = 0);386 _003C_003Eu__1 = val;387 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntityCollection>, _003CFindManager_003Ed__0>(ref val, ref this);388 return;389 }390 }391 else392 {393 val = _003C_003Eu__1;394 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntityCollection>);395 num = (_003C_003E1__state = -1);396 }397 IEntityCollection result = val.GetResult();398 result2 = ((((System.Collections.Generic.IReadOnlyCollection<IEntity>)result).Count > 0) ? ((string)((System.Collections.Generic.IReadOnlyList<IEntity>)result)[0].GetValue("UID_Person")) : "");399 }400 catch (System.Exception exception)401 {402 _003C_003E1__state = -2;403 _003C_003Et__builder.SetException(exception);404 return;405 }406 _003C_003E1__state = -2;407 _003C_003Et__builder.SetResult(result2);408 }409410 [DebuggerHidden]411 private void SetStateMachine(IAsyncStateMachine stateMachine)412 {413 _003C_003Et__builder.SetStateMachine(stateMachine);414 }415 }416417 [AsyncStateMachine(typeof(_003CFindManager_003Ed__0))]418 private static async System.Threading.Tasks.Task<string> FindManager(string where, ISession session, CancellationToken ct)419 {420 //IL_0002: Unknown result type (might be due to invalid IL or missing references)421 //IL_0007: Unknown result type (might be due to invalid IL or missing references)422 //IL_001e: Unknown result type (might be due to invalid IL or missing references)423 //IL_001f: Unknown result type (might be due to invalid IL or missing references)424 ISqlFormatter sqlFormatter = session.SqlFormatter();425 string uid = session.User().Uid;426 Query query = Query.From("Person").Select("UID_Person").Where(where)427 .Where(sqlFormatter.UidComparison("UID_Person", uid, CompareOperator.NotEqual))428 .Where("isinactive = 0")429 .Where(" not(" + sqlFormatter.EmptyClause("DefaultEMailAddress", ValType.String) + ")");430 IEntityCollection entityCollection = await session.Source().GetCollectionAsync(query, EntityCollectionLoadType.Default, ct).ConfigureAwait(false);431 return (((System.Collections.Generic.IReadOnlyCollection<IEntity>)entityCollection).Count > 0) ? ((string)((System.Collections.Generic.IReadOnlyList<IEntity>)entityCollection)[0].GetValue("UID_Person")) : "";432 }433434 [AsyncStateMachine(typeof(_003CCreatePasscodeAsync_003Ed__1))]435 public async System.Threading.Tasks.Task<PersonPasscodeResult> CreatePasscodeAsync(ISession session, string uid, int hoursValid, CancellationToken ct = default(CancellationToken))436 {437 //IL_0002: Unknown result type (might be due to invalid IL or missing references)438 //IL_0007: Unknown result type (might be due to invalid IL or missing references)439 //IL_0026: Unknown result type (might be due to invalid IL or missing references)440 //IL_0028: Unknown result type (might be due to invalid IL or missing references)441 ISqlFormatter sqlf = session.SqlFormatter();442 string whereClause = sqlf.UidComparison("UID_Person", uid);443 Query query = Query.From("Person").SelectAll().Where(whereClause);444 IEntity person = await session.Source().GetAsync(query, EntityLoadType.Interactive, ct).ConfigureAwait(false);445 string passcode = (string)(await person.CallFunctionAsync("CreatePassCode", hoursValid, ct).ConfigureAwait(false));446 using (IUnitOfWork u = session.StartUnitOfWork())447 {448 await u.PutAsync(person, ct).ConfigureAwait(false);449 await u.CommitAsync(ct).ConfigureAwait(false);450 }451 bool passcodesplit = false;452 string uidPersonmanager = "";453 IConnection connection = session.Resolve<IConnection>();454 string obj = await session.Config().GetConfigParmAsync("QER\\Person\\PasswordResetAuthenticator\\PasscodeSplit", ct).ConfigureAwait(false);455 int num = passcode.Length / 2;456 string firstPart = passcode.Substring(0, num);457 string secondpart = passcode.Substring(num);458 if (obj.Equals("1"))459 {460 passcodesplit = true;461 uidPersonmanager = await FindManager(string.Format("UID_Person in (select uid_personhead from person where {0})", (object)sqlf.UidComparison("UID_Person", uid)), session, ct).ConfigureAwait(false);462 if (!string.IsNullOrEmpty(uidPersonmanager))463 {464 DbObjectKey dbObjectKey = new DbObjectKey(person.GetValue("XObjectKey"));465 JobGen.Generate(parameters: (IDictionary)(object)new Dictionary<string, string>466 {467 ["UID_PersonHead"] = uidPersonmanager,468 ["PassCode"] = secondpart469 }, baseObject: dbObjectKey.GetObject(connection), eventname: "SEND_PASSCODE_TO_MANAGER");470 session.GetLogSession().Debug("PasscodeSplit: sending passcode portion to manager {0} found for {1}", uidPersonmanager, uid);471 }472 else473 {474 session.GetLogSession().Debug("PasscodeSplit: split is not possible because no manager found for {0}", uid);475 passcodesplit = false;476 }477 }478 if (passcodesplit)479 {480 passcode = firstPart;481 }482 return new PersonPasscodeResult483 {484 PassCode = passcode,485 PasscodeSplit = passcodesplit,486 HoursValid = hoursValid,487 UID_PersonManager = uidPersonmanager488 };489 }490}491