コード例 #1
0
 public SampleService(IApplicationLifetime appLifeTime,
                      IConfiguration config,
                      IOptions <JsonSettingModel> json,
                      IOptions <IniSettingModel> ini,
                      IOptions <XmlSettingModel> xml,
                      IOptions <UserSecretModel> userSecret,
                      IOptions <CommandLineSettingModel> commandLine)
 {
     this.appLifeTime = appLifeTime;
     this.config      = config;
     this.ini         = ini.Value;
     this.json        = json.Value;
     this.xml         = xml.Value;
     this.userSecret  = userSecret.Value;
     this.commandLine = commandLine.Value;
 }
コード例 #2
0
        public async Task <IActionResult> GenerateMfaCode(UserSecretModel model)
        {
            if (!int.TryParse(model.UserCode, out _) || model.UserCode.Length != 6)
            {
                ModelState.AddModelError(nameof(model.UserCode), "OTP should be numeric and of 6 digits.");
            }

            if (ModelState.IsValid)
            {
                model.IsVerified = await _userHelper.VerifyToken(model.UserCode, model.DeviceName);
            }


            await GenerateSecret();

            return(View(model));
        }