public async Task <bool> GenerateCode(VerificationType type, string userId, Func <VerificationCode, Task> onSuccessfulGeneration) { var outstandingRequest = await this.verificationRequestRepository.GetVerificationRequest(type, userId); if (outstandingRequest != null && outstandingRequest.IsActive()) { this.logger.LogInformation("User {userId} tried to request an active code when one was already available", userId); return(false); } var verificationRequest = VerificationRequest.GenerateNewVerificationRequest(userId, type, VerificationCode.Generate()); await this.verificationRequestRepository.StoreNewVerificationRequest(verificationRequest); // todo config the time KYC-43 try { await onSuccessfulGeneration(verificationRequest.Code); } catch (SenderException) { this.logger.LogWarning("Failed to dispatch verification code to user"); return(false); } return(true); }
public void SendVerificationEmail( VerificationType type, string varificationLink, string email ) { var emailPayload = GetEmailPayload(type, varificationLink); var message = new MimeMessage { From = { config.AdminMailboxAddress }, To = { new MailboxAddress("", email) }, Subject = emailPayload.Subject, Body = emailPayload.Body }; using var client = new SmtpClient(); client.Connect( config.SmtpServerConfig.ServerAddress, config.SmtpServerConfig.Portnumber, false); client.Authenticate( config.SmtpServerConfig.EmailAddress, config.SmtpServerConfig.Password); client.Send(message); client.Disconnect(true); }
public bool Run(VerificationType verificationType) { logger.Info ("Starting Verify"); bool same = true; Archive.ReadIndex (); if (verificationType == VerificationType.ArchiveHashWithArchiveData) { foreach (ArchiveItem rootItem in Archive.RootItems) { if (!ProcessArchiveItem (rootItem)) same = false; } } else { rootItems = Archive.RootItems.ToList (); foreach (IOrigin origin in Origins) { if (!ProcessOrigin (origin, verificationType)) same = false; } foreach (ArchiveItem item in rootItems) { logger.WarnFormat ("Only present in Archive: {0}", item.Name); same = false; } } logger.Info ("Finished Verify"); return same; }
// public methods... #region Add public EnvironmentVerificationItem Add(VerificationType verificationType, string message) { EnvironmentVerificationItem itm = new EnvironmentVerificationItem(verificationType, message); this.Add(itm); return(itm); }
public VerificationTypeInfo(ref ReadOnlySpan <byte> data, CPInfo[] constants) { Tag = data.ReadOne(); Type = (VerificationType)Tag; ObjectType = null; Offset = 0; switch (Type) { case VerificationType.TopVariable: case VerificationType.IntegerVariable: case VerificationType.FloatVariable: case VerificationType.LongVariable: case VerificationType.DoubleVariable: case VerificationType.NullVariable: case VerificationType.UninitializedThisVariable: break; case VerificationType.ObjectVariable: ushort cPoolIndex = data.ReadTwo(); ObjectType = ((CClassInfo)constants[cPoolIndex]); break; case VerificationType.UninitializedVariable: Offset = data.ReadTwo(); break; } }
public RotationSpell(string name, uint?rank = null, bool ignoresGlobal = false, VerificationType type = VerificationType.CAST_RESULT) { Spell = new Spell(name); _name = Spell.NameInGame; _rank = rank; _ignoresGlobal = ignoresGlobal; Verification = type; }
async private Task InvalidSecretErrorAsync(VerificationType verificationType) { var errorMessage = verificationType == VerificationType.OTP ? _i18nService.T("InvalidVerificationCode") : _i18nService.T("InvalidMasterPassword"); await _platformUtilsService.ShowDialogAsync(errorMessage); }
public bool HasFailedCriteras(Guid withdrawalId, VerificationType type) { return(_repository .WithdrawalVerificationLogs .Where(x => x.WithdrawalId == withdrawalId) .Where(x => x.VerificationType == type) .Any(x => !x.IsSuccess)); }
public VerificationEntry(string assembly, VerificationType type, string section, string error, string description, Token token) { this.Assembly = assembly; this.Type = type; this.Section = section; this.Rule = error; this.Description = description; this.Location = token; }
internal static ImageInformation DeserializeImageInformation(JsonElement element) { string nodeAgentSKUId = default; ImageReference imageReference = default; OSType osType = default; IReadOnlyList <string> capabilities = default; DateTimeOffset? batchSupportEndOfLife = default; VerificationType verificationType = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nodeAgentSKUId")) { nodeAgentSKUId = property.Value.GetString(); continue; } if (property.NameEquals("imageReference")) { imageReference = ImageReference.DeserializeImageReference(property.Value); continue; } if (property.NameEquals("osType")) { osType = property.Value.GetString().ToOSType(); continue; } if (property.NameEquals("capabilities")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } capabilities = array; continue; } if (property.NameEquals("batchSupportEndOfLife")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } batchSupportEndOfLife = property.Value.GetDateTimeOffset("S"); continue; } if (property.NameEquals("verificationType")) { verificationType = property.Value.GetString().ToVerificationType(); continue; } } return(new ImageInformation(nodeAgentSKUId, imageReference, osType, capabilities, batchSupportEndOfLife, verificationType)); }
internal ImageInformation(string nodeAgentSKUId, ImageReference imageReference, OSType osType, IReadOnlyList <string> capabilities, DateTimeOffset?batchSupportEndOfLife, VerificationType verificationType) { NodeAgentSKUId = nodeAgentSKUId; ImageReference = imageReference; OsType = osType; Capabilities = capabilities; BatchSupportEndOfLife = batchSupportEndOfLife; VerificationType = verificationType; }
/// <summary> /// Generate the necessary parameters /// </summary> public List <KeyValuePair <string, string> > GetParams() { var p = new List <KeyValuePair <string, string> >(); if (FriendlyName != null) { p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName)); } if (UniqueName != null) { p.Add(new KeyValuePair <string, string>("UniqueName", UniqueName)); } if (Email != null) { p.Add(new KeyValuePair <string, string>("Email", Email)); } if (CcEmails != null) { p.AddRange(CcEmails.Select(prop => new KeyValuePair <string, string>("CcEmails", prop))); } if (Status != null) { p.Add(new KeyValuePair <string, string>("Status", Status.ToString())); } if (VerificationCode != null) { p.Add(new KeyValuePair <string, string>("VerificationCode", VerificationCode)); } if (VerificationType != null) { p.Add(new KeyValuePair <string, string>("VerificationType", VerificationType.ToString())); } if (VerificationDocumentSid != null) { p.Add(new KeyValuePair <string, string>("VerificationDocumentSid", VerificationDocumentSid.ToString())); } if (Extension != null) { p.Add(new KeyValuePair <string, string>("Extension", Extension)); } if (CallDelay != null) { p.Add(new KeyValuePair <string, string>("CallDelay", CallDelay.ToString())); } return(p); }
/// <summary> /// Initializes a new instance of the ImageInformation class. /// </summary> /// <param name="nodeAgentSKUId">The ID of the Compute Node agent SKU /// which the Image supports.</param> /// <param name="imageReference">The reference to the Azure Virtual /// Machine's Marketplace Image.</param> /// <param name="osType">The type of operating system (e.g. Windows or /// Linux) of the Image.</param> /// <param name="verificationType">Whether the Azure Batch service /// actively verifies that the Image is compatible with the associated /// Compute Node agent SKU.</param> /// <param name="capabilities">The capabilities or features which the /// Image supports.</param> /// <param name="batchSupportEndOfLife">The time when the Azure Batch /// service will stop accepting create Pool requests for the /// Image.</param> public ImageInformation(string nodeAgentSKUId, ImageReference imageReference, OSType osType, VerificationType verificationType, IList <string> capabilities = default(IList <string>), System.DateTime?batchSupportEndOfLife = default(System.DateTime?)) { NodeAgentSKUId = nodeAgentSKUId; ImageReference = imageReference; OsType = osType; Capabilities = capabilities; BatchSupportEndOfLife = batchSupportEndOfLife; VerificationType = verificationType; CustomInit(); }
private bool IsArrayElementCompatibleWith(TypeSpec w) { var v = this.UnderlyingType; w = w.UnderlyingType; if (IsAssignmentCompatibleWith(w)) { return(true); } return(VerificationType.Equals(w.VerificationType)); }
private string GetVerificationLink( VerificationType type, string email, string code ) { string endpoint = type == VerificationType.Email ? "ConfirmEmail/" : "VerifyIdentity/"; return(Request.Scheme + "://" + Request.Host + "/api/Users/" + endpoint + email + "/" + code); }
internal static string ToSerializedValue(this VerificationType value) { switch (value) { case VerificationType.Verified: return("verified"); case VerificationType.Unverified: return("unverified"); } return(null); }
/// <summary> /// 根据条件查询 /// </summary> /// <param name="type"></param> /// <param name="to"></param> /// <returns></returns> public IEnumerable <Model.Verification> Query(VerificationType type, string to) { Sql sql = new Sql("SELECT * FROM tn_Verification"); Sql whereSql = new Sql(); Sql orderSql = new Sql(); whereSql.Where("[Type]=@0", type); whereSql.Where("[To]=@0", to); whereSql.Where("DATEDIFF(MINUTE,DateCreated,GETDATE())<3"); orderSql.OrderBy("DateCreated desc"); sql.Append(whereSql).Append(orderSql); return(db.Query <Model.Verification>(sql)); }
public VerificationRequest( string userId, VerificationType verificationType, VerificationRequestStatus status, DateTime expiryDate, VerificationCode code, int attempts) { this.UserId = userId; this.ExpiryDate = expiryDate; this.VerificationType = verificationType; this.Code = code; this.Status = status; this.Attempts = attempts; }
internal ImageInformation(string nodeAgentSKUId, ImageReference imageReference, OSType osType, VerificationType verificationType) { if (nodeAgentSKUId == null) { throw new ArgumentNullException(nameof(nodeAgentSKUId)); } if (imageReference == null) { throw new ArgumentNullException(nameof(imageReference)); } NodeAgentSKUId = nodeAgentSKUId; ImageReference = imageReference; OsType = osType; VerificationType = verificationType; }
private EmailPayload GetEmailPayload( VerificationType type, string verificationLink ) { bool verifyEmail = type == VerificationType.Email; return(new EmailPayload { Subject = verifyEmail ? "E-Mail Bestätigung" : "Verifikation", Body = new TextPart("html") { Text = type == VerificationType.Email ? GetEmailVerificationBody(verificationLink) : GetIdentityVerificationBody(verificationLink) } }); }
/// <summary> /// Overriding the base method to only trigger on PlayFab supported platforms. /// </summary> public override bool shouldValidate(VerificationType verificationType) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_TVOS) if (Application.platform == RuntimePlatform.Android && (StandardPurchasingModule.Instance().androidStore != AndroidStore.GooglePlay)) //&& StandardPurchasingModule.Instance().androidStore != AndroidStore.AmazonAppStore)) { return(false); } if (this.verificationType == verificationType) { return(true); } #endif return(false); }
public async Task <bool> VerifyCode(VerificationType type, string userId, VerificationCode code) { var storedCodeRequest = await this.verificationRequestRepository.GetVerificationRequest(type, userId); if (storedCodeRequest == null) { this.logger.LogWarning("User ({userId}) tried to verify a code that hasn't been requested", userId); return(false); } var validatedRequest = storedCodeRequest.ValidateCode(code); await this.verificationRequestRepository.UpdateAttemptedRequest(validatedRequest); // todo problem+json stuff KYC-36 return(validatedRequest.Status == VerificationRequestStatus.Confirmed); }
public static VerificationType CreateVerification( int recordId, string USI, string firstName, string lastName, DateTime dateOfBirth) { var verificationType = new VerificationType { RecordId = recordId, DateOfBirth = dateOfBirth, ItemsElementName = new[] { ItemsChoiceType1.FirstName, ItemsChoiceType1.FamilyName }, Items = new[] { firstName, lastName }, USI = USI }; return(verificationType); }
public static short GetVerification(VerificationType type) { switch(type) { case VerificationType.Rejected: return -3; case VerificationType.Closed: return -2; case VerificationType.Withdrawn: return -1; case VerificationType.Unapproved: return 0; case VerificationType.Approved: return 1; } return 0; }
public ActionResult Verify(string id, VerificationType verificationType) { var user = this.Data.Users.GetById(id); var userId = this.User.Identity.GetUserId(); var userStore = new UserStore <User>(this.Data.Context.DbContext); var userManager = new UserManager <User>(userStore); var forwardUrl = string.Empty; switch (verificationType) { case VerificationType.Student: user.IsVerified = true; userManager.AddToRole(user.Id, GlobalConstants.NOT_COMPLETE_USER); userManager.AddToRole(user.Id, GlobalConstants.VERIFIED_USER); userManager.AddToRole(user.Id, GlobalConstants.STUDENT); userManager.RemoveFromRole(user.Id, GlobalConstants.NOT_VERIFIED_USER); forwardUrl = string.Format(GlobalPatternConstants.FORWARD_URL_WITH_ID, "User", "Account", id); break; case VerificationType.Teacher: user.IsVerified = true; userManager.AddToRole(user.Id, GlobalConstants.NOT_COMPLETE_USER); userManager.AddToRole(user.Id, GlobalConstants.VERIFIED_USER); userManager.AddToRole(user.Id, GlobalConstants.TEACHER); userManager.RemoveFromRole(user.Id, GlobalConstants.NOT_VERIFIED_USER); forwardUrl = string.Format(GlobalPatternConstants.FORWARD_URL_WITH_ID, "User", "Account", id); break; case VerificationType.Bot: this.Data.Users.Delete(user); this.Data.SaveChanges(); return(RedirectToAction("Verification", "User", new { id = id })); default: break; } this.Data.SaveChanges(); this.CreateNotification(id, userId, forwardUrl, GlobalPatternConstants.NOTIFICATION_USER_VERIFIED); return(RedirectToAction("Account", "User", new { id = id })); }
bool ProcessOrigin(IOrigin origin, VerificationType verificationType) { bool same = true; IOriginItem originItem = origin.GetRootItem(); var item = rootItems.SingleOrDefault(p => p.Name == originItem.Name); if (item != null) { rootItems.Remove(item); same = ProcessOriginItem(item, originItem, verificationType); } else { logger.WarnFormat("Only present in origin: {0}", item.Name); same = false; } return(same); }
public async Task <VerificationRequest> GetVerificationRequest(VerificationType type, string userId) { var table = await this.GetTableAsync(); var tableResult = await table.ExecuteAsync(TableOperation.Retrieve <VerificationRequestEntity>(userId, type.ToString())); if (tableResult.HttpStatusCode != 200) { return(null); } var result = (VerificationRequestEntity)tableResult.Result; return(new VerificationRequest( result.UserId, Enum.Parse <VerificationType>(result.VerificationType), (VerificationRequestStatus)result.Status, result.ExpirationDate, new VerificationCode(result.Code), result.Attempts)); }
public void LogWithdrawalVerificationStep(Guid withdrawalId, bool isSuccess, VerificationType type, VerificationStep step, string completeRuleDesc, string ruleRequiredValues, string criteriaActualValue) { using (var scope = CustomTransactionScope.GetTransactionScope()) { var withdrawalVerificationLog = new WithdrawalVerificationLog { Id = Guid.NewGuid(), IsSuccess = isSuccess, VerificationStep = step, VerificationType = type, WithdrawalId = withdrawalId, VerificationRule = completeRuleDesc, RuleRequiredValue = ruleRequiredValues, CurrentValue = criteriaActualValue }; _repository.WithdrawalVerificationLogs.Add(withdrawalVerificationLog); _repository.SaveChanges(); scope.Complete(); } }
public static short GetVerification(VerificationType type) { switch (type) { case VerificationType.Rejected: return(-3); case VerificationType.Closed: return(-2); case VerificationType.Withdrawn: return(-1); case VerificationType.Unapproved: return(0); case VerificationType.Approved: return(1); } return(0); }
public bool Run(VerificationType verificationType) { logger.Info("Starting Verify"); bool same = true; Archive.ReadIndex(); if (verificationType == VerificationType.ArchiveHashWithArchiveData) { foreach (ArchiveItem rootItem in Archive.RootItems) { if (!ProcessArchiveItem(rootItem)) { same = false; } } } else { rootItems = Archive.RootItems.ToList(); foreach (IOrigin origin in Origins) { if (!ProcessOrigin(origin, verificationType)) { same = false; } } foreach (ArchiveItem item in rootItems) { logger.WarnFormat("Only present in Archive: {0}", item.Name); same = false; } } logger.Info("Finished Verify"); return(same); }
/// <summary> /// 创建验证 /// </summary> /// <param name="type"></param> /// <param name="to"></param> /// <param name="verifyCode"></param> /// <param name="dateCreated"></param> public void Create(VerificationType type, string to) { string chkCode = string.Empty; //验证码的字符集,去掉了一些容易混淆的字符 char[] character = { '2', '3', '4', '5', '6', '8', '9', 'a', 'b', 'd', 'e', 'f', 'h', 'k', 'm', 'n', 'r', 'x', 'y', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', 'X', 'Y' }; Random rnd = new Random(); //生成验证码字符串 for (int i = 0; i < 4; i++) { chkCode += character[rnd.Next(character.Length)]; } Model.Verification entity = new Model.Verification() { Type = type, To = to, VerifyCode = chkCode, DateCreated = DateTime.Now }; if (type == VerificationType.Phone) { UCSRestRequest.UCSRestRequest api = new UCSRestRequest.UCSRestRequest(); string serverIp = "api.ucpaas.com"; string serverPort = "443"; string account = "e5bbac9f08b8900cb5c5e488f792cc0b"; //用户sid string token = "3499976b631aed9120c1106d8b9dc694"; //用户sid对应的token string appId = "bbcfd83149ab4016a89f9208f8a41b50"; //对应的应用id,非测试应用需上线使用 api.init(serverIp, serverPort); api.setAccount(account, token); api.enabeLog(true); api.setAppId(appId); api.enabeLog(true); //短信 api.SendSMS(entity.To, "48224", entity.VerifyCode); } dal.Create(entity); }
async public Task <bool> VerifyUser(string secret, VerificationType verificationType) { if (string.IsNullOrEmpty(secret)) { await InvalidSecretErrorAsync(verificationType); return(false); } if (verificationType == VerificationType.OTP) { var request = new VerifyOTPRequest(secret); try { await _apiService.PostAccountVerifyOTPAsync(request); } catch { await InvalidSecretErrorAsync(verificationType); return(false); } } else { var passwordValid = await _cryptoService.CompareAndUpdateKeyHashAsync(secret, null); if (!passwordValid) { await InvalidSecretErrorAsync(verificationType); return(false); } } return(true); }
bool ProcessOrigin(IOrigin origin, VerificationType verificationType) { bool same = true; IOriginItem originItem = origin.GetRootItem (); var item = rootItems.SingleOrDefault (p => p.Name == originItem.Name); if (item != null) { rootItems.Remove (item); same = ProcessOriginItem (item, originItem, verificationType); } else { logger.WarnFormat ("Only present in origin: {0}", item.Name); same = false; } return same; }
public OTA_ReadRQReadRequestsReadRequest() { this._verification = new VerificationType(); this._uniqueID = new UniqueID_Type(); }
/// <summary> /// Initializes a new instance of the EnvironmentVerificationItem class taking type and message. /// </summary> /// <param name="verificationType">Type of item, can be used to stop processing for an example.</param> /// <param name="message">A message explaining the </param> public EnvironmentVerificationItem(VerificationType verificationType, string message) { _message = message; _verificationType = verificationType; }
public EnvironmentVerificationItem Add(VerificationType verificationType, string message) { EnvironmentVerificationItem itm = new EnvironmentVerificationItem(verificationType, message); this.Add(itm); return itm; }
public ActionResult Verify(string id, VerificationType verificationType) { var user = this.Data.Users.GetById(id); var userId = this.User.Identity.GetUserId(); var userStore = new UserStore<User>(this.Data.Context.DbContext); var userManager = new UserManager<User>(userStore); var forwardUrl = string.Empty; switch (verificationType) { case VerificationType.Student: user.IsVerified = true; userManager.AddToRole(user.Id, GlobalConstants.NOT_COMPLETE_USER); userManager.AddToRole(user.Id, GlobalConstants.VERIFIED_USER); userManager.AddToRole(user.Id, GlobalConstants.STUDENT); userManager.RemoveFromRole(user.Id, GlobalConstants.NOT_VERIFIED_USER); forwardUrl = string.Format(GlobalPatternConstants.FORWARD_URL_WITH_ID, "User", "Account", id); break; case VerificationType.Teacher: user.IsVerified = true; userManager.AddToRole(user.Id, GlobalConstants.NOT_COMPLETE_USER); userManager.AddToRole(user.Id, GlobalConstants.VERIFIED_USER); userManager.AddToRole(user.Id, GlobalConstants.TEACHER); userManager.RemoveFromRole(user.Id, GlobalConstants.NOT_VERIFIED_USER); forwardUrl = string.Format(GlobalPatternConstants.FORWARD_URL_WITH_ID, "User", "Account", id); break; case VerificationType.Bot: this.Data.Users.Delete(user); this.Data.SaveChanges(); return RedirectToAction("Verification", "User", new { id = id }); default: break; } this.Data.SaveChanges(); this.CreateNotification(id, userId, forwardUrl, GlobalPatternConstants.NOTIFICATION_USER_VERIFIED); return RedirectToAction("Account", "User", new { id = id }); }
bool ProcessOriginItem(ArchiveItem archiveItem, IOriginItem originItem, VerificationType verificationType) { bool same = true; logger.InfoFormat ("Verifying {0}", originItem.Name); using (Stream inputStream = originItem.OpenStream()) { if (inputStream != null) { if (verificationType == VerificationType.ArchiveHashWithOriginData) { if (!streamVerifier.Verify (inputStream, archiveItem.DataStreamHash)) same = false; } else if (verificationType == VerificationType.ArchiveDataWithOriginData) { using (Stream outputStream = archiveItem.OpenDataStream()) { if (outputStream != null) { if (!streamVerifier.Verify (inputStream, outputStream)) same = false; } else { logger.WarnFormat ("Only present in Origin: {0}", originItem.Name); same = false; } } } else { throw new InvalidOperationException (); } } else { using (Stream outputStream = archiveItem.OpenDataStream()) { if (outputStream != null) { logger.WarnFormat ("Only present in Archive: {0}", archiveItem.Name); same = false; } } } } var childItems = archiveItem.ChildItems.ToList (); foreach (IOriginItem subOriginItem in originItem.ChildItems) { var item = childItems.SingleOrDefault (p => p.Name == subOriginItem.Name); if (item != null) { childItems.Remove (item); if (!ProcessOriginItem (item, subOriginItem, verificationType)) same = false; } else { logger.WarnFormat ("Only present in Origin: {0}", subOriginItem.Name); same = false; } } foreach (var childItem in childItems) { logger.WarnFormat ("Only present in Archive: {0}", childItem.Name); same = false; } return same; }
public VerificationEntry(string assembly, VerificationType type, string section, string error, string description) : this(assembly, type, section, error, description, Token.Zero) { }