From 2f90b2f16da94ff4271e89b4682a5ff5e67c3eb2 Mon Sep 17 00:00:00 2001 From: dquach217 Date: Sun, 16 Jun 2019 22:08:27 -0400 Subject: [PATCH 1/2] wrap the entire form with check of env var --- .../devise/registrations/_form.html.haml | 29 ++++++++-------- app/views/devise/sessions/_form.html.haml | 33 ++++++++++--------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/app/views/devise/registrations/_form.html.haml b/app/views/devise/registrations/_form.html.haml index b93d2b8b9..329aa7721 100644 --- a/app/views/devise/registrations/_form.html.haml +++ b/app/views/devise/registrations/_form.html.haml @@ -1,15 +1,16 @@ = simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| - .form-actions - .center - = render 'my_mlh_cta' - %p - %em or continue manually: - .form-inputs - = f.input :email, required: true, autofocus: true - = f.input :password, required: true - = f.input :password_confirmation, required: true, label:"Confirm" - .form-actions.right - = f.button :submit, "Register" - %p.session-link - Have an account? - = link_to "Sign in!".html_safe, new_user_session_path + - if ENV["MLH_KEY"].present? + .form-actions + .center + = render 'my_mlh_cta' + %p + %em or continue manually: + .form-inputs + = f.input :email, required: true, autofocus: true + = f.input :password, required: true + = f.input :password_confirmation, required: true, label:"Confirm" + .form-actions.right + = f.button :submit, "Register" + %p.session-link + Have an account? + = link_to "Sign in!".html_safe, new_user_session_path diff --git a/app/views/devise/sessions/_form.html.haml b/app/views/devise/sessions/_form.html.haml index 9cf95a6bb..735a9c16f 100644 --- a/app/views/devise/sessions/_form.html.haml +++ b/app/views/devise/sessions/_form.html.haml @@ -1,17 +1,18 @@ = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| - .form-actions - .center - = render 'my_mlh_cta' - %p - %em or use an email & password: - .form-inputs - = f.input :email, required: false, input_html: { autofocus: true } - = f.input :password, required: false - = f.input :remember_me, as: :boolean if devise_mapping.rememberable? - .form-actions.right - = f.button :submit, "Sign In" - %p.session-link - No account? - = link_to "Register!".html_safe, new_user_registration_path - %p.session-link - = link_to "Forgot password", new_user_password_path + - if ENV["MLH_KEY"].present? + .form-actions + .center + = render 'my_mlh_cta' + %p + %em or use an email & password: + .form-inputs + = f.input :email, required: false, input_html: { autofocus: true } + = f.input :password, required: false + = f.input :remember_me, as: :boolean if devise_mapping.rememberable? + .form-actions.right + = f.button :submit, "Sign In" + %p.session-link + No account? + = link_to "Register!".html_safe, new_user_registration_path + %p.session-link + = link_to "Forgot password", new_user_password_path From 5d591c0c9916e0a1f19d40d1ccb5af8a0223e9dd Mon Sep 17 00:00:00 2001 From: dquach217 Date: Mon, 17 Jun 2019 21:36:36 -0400 Subject: [PATCH 2/2] display the form correctly --- .../devise/registrations/_form.html.haml | 18 +++++++-------- app/views/devise/sessions/_form.html.haml | 22 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/views/devise/registrations/_form.html.haml b/app/views/devise/registrations/_form.html.haml index 329aa7721..6ea83cf76 100644 --- a/app/views/devise/registrations/_form.html.haml +++ b/app/views/devise/registrations/_form.html.haml @@ -5,12 +5,12 @@ = render 'my_mlh_cta' %p %em or continue manually: - .form-inputs - = f.input :email, required: true, autofocus: true - = f.input :password, required: true - = f.input :password_confirmation, required: true, label:"Confirm" - .form-actions.right - = f.button :submit, "Register" - %p.session-link - Have an account? - = link_to "Sign in!".html_safe, new_user_session_path + .form-inputs + = f.input :email, required: true, autofocus: true + = f.input :password, required: true + = f.input :password_confirmation, required: true, label:"Confirm" + .form-actions.right + = f.button :submit, "Register" + %p.session-link + Have an account? + = link_to "Sign in!".html_safe, new_user_session_path diff --git a/app/views/devise/sessions/_form.html.haml b/app/views/devise/sessions/_form.html.haml index 735a9c16f..1ee73daf6 100644 --- a/app/views/devise/sessions/_form.html.haml +++ b/app/views/devise/sessions/_form.html.haml @@ -5,14 +5,14 @@ = render 'my_mlh_cta' %p %em or use an email & password: - .form-inputs - = f.input :email, required: false, input_html: { autofocus: true } - = f.input :password, required: false - = f.input :remember_me, as: :boolean if devise_mapping.rememberable? - .form-actions.right - = f.button :submit, "Sign In" - %p.session-link - No account? - = link_to "Register!".html_safe, new_user_registration_path - %p.session-link - = link_to "Forgot password", new_user_password_path + .form-inputs + = f.input :email, required: false, input_html: { autofocus: true } + = f.input :password, required: false + = f.input :remember_me, as: :boolean if devise_mapping.rememberable? + .form-actions.right + = f.button :submit, "Sign In" + %p.session-link + No account? + = link_to "Register!".html_safe, new_user_registration_path + %p.session-link + = link_to "Forgot password", new_user_password_path