Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:05:24+00:00 2026-06-08T07:05:24+00:00

Recently got a new job as a Rails developer, having never previously used the

  • 0

Recently got a new job as a Rails developer, having never previously used the language and it’s quite a leap.

I’m working on a locked screen effect for the website, where a link can be clicked which blanks the webpage and requires the user to enter their password again in order to remove the overlay. The overlay is a jQuery modal as follows:

$().ready( function() {
    $('.blackoutwindow').jqm({
        modal: true,
        trigger: '.blackout',
        overlay: 100
    });
    if (boset) {
        $('.blackoutwindow').jqmShow();
    }
});

When the link with id “blackout” is clicked the window appears. The JS variable boset is set in my view from a Rails session var which determines if the user has the screen blanked (so that the blanking persists on refresh, etc) <%= javascript_tag "var boset = #{session[:blanked]} "%>

Inside the modal div is my Rails password form:

<%= form_tag passcheck_path, :id => "passcheck", :remote => true do -%>
<%= hidden_field_tag :email, current_user.email %>
<ul>
    <li><%= password_field_tag 'password', nil, { :size => 30, :maxlength => 80, :class => :required } %></li>
    <li><%= submit_tag 'Submit' %></li>
    <li><span class="ajaxmessage">&nbsp;</span></li>
</ul>
<% end -%>

Which (by means which I don’t really understand) sends the password to an action in my sessions_controller.rb called passcheck, in a kind of AJAX style, which authenticates the password.

Now that I’ve explained where I am currently, how do I now close the jQuery modal if the password is correct, update the span .ajaxmessage if the password isn’t correct, and also, set the session variable when someone originally clicks on the “blank screen” link?

Hope I was clear enough, any questions, fire away..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:05:25+00:00Added an answer on June 8, 2026 at 7:05 am

    Got it working, mostly, except this remaining problem.

    In my controller I put:

    def passcheck  
      if request.get? # This is for when the link is clicked
        session[:blanked] = true 
      else # This is when the password form is submitted
        if user = User.authenticate( params[:email], params[:password] )
          @valid = true
          session[:blanked] = false
        end
      end 
    end
    

    Then I created a passcheck.js.erb which is the javascript that I want executed when the form is submitted:

    <% if @valid %>
    $('.blackoutwindow').jqmHide();
    $('.ajaxmessage').html('&nbsp;');
    $("#passcheck input[name=password]").val("");
    <% else %> $('.ajaxmessage').html('<p style="color: #000">Incorrect password, please try again.</p>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Spring. I just recently got an example working with annotations and
I recently got a new primary computer. On my old one, I was working
recently I got a job interview for a web developer position. They ask me
I recently migrated from rails 2 to Rails 3 and thus got the new
I'm quite new at WPF and recently encountered a problem. I got an ObservableCollection<
I recently got a shiny new development workstation. The only disadvantage of this is
I'm using Visual Studio 2008 Professional at work. Recently, I got a new workstation.
I've recently got a new Mac laptop and am running VS2010 in a Parallels
Quick question; I've recently upgraded to VS2010, and got the new version of ReSharper.
I recently got a new workstation where I'm using Visual Studio 2008 Professional for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.