Click or drag to resize

SealSecurityDefaultTwoFACheckScript Field

Default implementation used when TwoFACheckScript is empty: checks the security code (5 minutes validity, 3 tries)

Namespace: Seal.Model
Assembly: SealLibrary (in SealLibrary.dll) Version: 10.0.1.0+a44cd3a7f03c2bf3cdbd971a878c679e40bed08a
Syntax
C#
public const string DefaultTwoFACheckScript = "@{\n    SecurityUser user = Model;\n\n    //Check that the code has been generated in the previous 5 minutes\n    if (string.IsNullOrEmpty(user.SecurityCode) || user.SecurityCodeGeneration < DateTime.Now.AddMinutes(-5)) {\n        user.SecurityCodeTries = -1; //Set it to -1 to re-force a login\n    }\n    else {\n        user.SecurityCodeTries++;\n        if (user.SecurityCode != user.WebSecurityCode)\n        {\n            if (user.SecurityCodeTries >= 3) user.SecurityCodeTries = -1; //Set it to -1 to re-force a login\n            else throw new Exception(user.Security.Repository.TranslateWeb("Invalid security code")); //Allow a retry\n        }\n        else {\n            user.SecurityCode = ""; //Check is ok\n        }\n    }\n}\n"

Field Value

String
See Also