/// <summary>
        /// Получить форму регистрации/авторизации
        /// </summary>
        /// <param name="user_login_input_id">html dom id/name - идентификатор/имя input-a ввода логина</param>
        /// <param name="user_password_input_id">html dom id/name - идентификатор/имя input-a ввода пароля</param>
        /// <param name="user_password_repeat_input_id">html dom id/name - идентификатор/имя input-a ввода повтора пороля</param>
        /// <param name="reg_new_user_chekbox_id">html dom id/name - идентификатор/имя chekbox-a для регистрации нового пользователя</param>
        /// <param name="button_send_login_form_id">html dom id/name - идентификатор/имя button-a </param>
        /// <param name="re_captcha_key">api - ключ reCaptcha</param>
        /// <param name="collapse_info_new_user_input_css">css класс - области сворачивания и разворачивания для регистрации</param>
        /// <returns></returns>
        public static List <base_dom_root> GetLoginForm(
            string re_captcha_key                   = null,
            string user_password_input_id           = "user_password_input_id",
            string user_password_repeat_input_id    = "user_password_repeat_input_id",
            string user_login_input_id              = "user_login_input_id",
            string reg_new_user_chekbox_id          = "reg_new_user_chekbox_id",
            string button_send_login_form_id        = "button_send_login_form_id",
            string collapse_info_new_user_input_css = "collapse_info_new_user_input")
        {
            List <base_dom_root> dom_elements = new List <base_dom_root>();

            form html_response = new form()
            {
                Id_DOM      = "login_form_id",
                target      = TargetsEnum._self,
                method_form = MethodsFormEnum.POST
            };

            html_response.AddCSS("was-validated");
            html_response.SetAttribute("novalidate", null);

            TextInput textInput = new TextInput("Ваш логин", user_login_input_id)
            {
                InputInfoFooter = "Введите логин для входа"
            };

            textInput.Input.placeholder = "Логин";
            textInput.Input.required    = true;
            html_response.AddDomNode(textInput);

            textInput = new TextInput("Ваш пароль", user_password_input_id)
            {
                InputInfoFooter = "Пароль для входа"
            };
            textInput.Input.type        = InputTypesEnum.password;
            textInput.Input.placeholder = "Пароль";
            html_response.AddDomNode(textInput);

            textInput = new TextInput("Повторите пароль", user_password_repeat_input_id)
            {
                InputInfoFooter = "Повторно введите пароль"
            };
            textInput.Input.type        = InputTypesEnum.password;
            textInput.Input.placeholder = "Повтор";

            textInput.AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true);
            html_response.AddDomNode(textInput);

            html_response.Childs[html_response.Childs.Count - 1].AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true);

            html_response.Childs.Add(new CheckboxInput("Зарегистрироваться", reg_new_user_chekbox_id));

            p reg_new_user_info = new p("");

            reg_new_user_info.AddCSS("clearfix");
            using (ul panel_collapse = new ul())
            {
                panel_collapse.AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true);
                reg_new_user_info.Childs.Add(panel_collapse);
            }

            reg_new_user_info.Childs[0].Childs.Add(new li()
            {
                InnerText = "Придумайте/запомните надёжный логин/пароль и входите"
            });
            reg_new_user_info.Childs[0].Childs.Add(new li()
            {
                InnerText = "Учётная запись будет создана автоматически"
            });

            html_response.Childs.Add(reg_new_user_info);
            if (!string.IsNullOrEmpty(re_captcha_key))
            {
                html_response.Childs.Add(new hr());
                html_response.Childs.Add(new h4("Пройдите проверку reCAPTCHA"));
                div sitekey = new div();
                sitekey.AddCSS("g-recaptcha");
                sitekey.SetAttribute("data-size", "compact");
                sitekey.SetAttribute("data-sitekey", re_captcha_key);
                html_response.Childs.Add(sitekey);
            }
            html_response.Childs.Add(GetButton("Войти", button_send_login_form_id, null, VisualBootstrapStylesEnum.primary, SizingBootstrap.Lg, true));

            dom_elements.Add(Get_DIV_Bootstrap_Card("Вход/Регистрация", html_response));
            return(dom_elements);
        }
Пример #2
0
 public LoginForm()
 {
     html_form.AddCSS("was-validated");
     CardHeader = "Вход/Регистрация";
     html_form.SetAttribute("novalidate", null);
 }