Exemplo n.º 1
0
        public async Task <ActionResult> LoginConfig()
        {
            using (LoginConfigDataProvider dataProvider = new LoginConfigDataProvider()) {
                Model model          = new Model {
                };
                LoginConfigData data = await dataProvider.GetItemAsync();

                if (data == null)
                {
                    throw new Error(this.__ResStr("notFound", "User login configuration was not found."));
                }
                model.SetData(data);
                return(View(model));
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> LoginConfig_Partial(Model model)
        {
            using (LoginConfigDataProvider dataProvider = new LoginConfigDataProvider()) {
                LoginConfigData data = await dataProvider.GetItemAsync();// get the original item

                if (!ModelState.IsValid)
                {
                    return(PartialView(model));
                }
                data = model.GetData(data); // merge new data into original
                model.SetData(data);        // and all the data back into model for final display
                await dataProvider.UpdateConfigAsync(data);

                Manager.Need2FAState = null;// we may have changed two-step auth settings, so re-evaluate
                return(FormProcessed(model, this.__ResStr("okSaved", "Configuration settings saved")));
            }
        }