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 4272878
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:38:14+00:00 2026-05-21T07:38:14+00:00

I have cotnrol_admin: def login if request.post? if params[:full_name] == mg && params[:password] ==

  • 0

I have cotnrol_admin:

  def login
    if request.post?
      if params[:full_name] == "mg" && params[:password] == "123"
        data = { :success => 'true', :msg => "Welcome, #{params[:full_name]}"}
        #redirect_to :action => :welcome
        #render :action => :welcome 
      else
        data = { :failure => 'true', :msg => "Username or Password wrong !"}
      end
      render :text => data.to_json, :layout => false
    end
  end

I have this login.js

var loginForm = new Ext.form.FormPanel({
    baseCls: 'x-plain',
    labelWidth: 75,
    url:'/admin/login',
    defaultType: 'textfield',
    items: [{
        fieldLabel: 'Login',
        name: 'full_name',
        anchor:'90%'  // anchor width by percentage
    },{
    fieldLabel: 'Password',
    name: 'password',
    inputType: 'password',
    anchor: '90%'  // anchor width by percentage
}],
buttons: [{
    text: 'Login',
    handler: function() {
        loginForm.getForm().submit(
            {
                method: 'POST',
                waitMsg:'Submitting...',

                reset : false,
                success : function() {
                    loginWindow.close();

                },
                failure: function(form, action){Ext.Msg.alert('Error',action.result.text)}
            });
        }
    }]

});

var loginWindow = new Ext.Window({
    title: 'Login',
    width: 300,
    height:140,
    closable:false,
    minWidth: 300,
    minHeight: 140,
    layout: 'fit',
    plain:true,
    modal:true,
    bodyStyle:'padding:5px;',
    items: loginForm
});
Ext.onReady(function(){
    loginWindow.show(this);
});

So my questions is: everythings work pefectly. But when i press refresh button this login form comes again, how i can avoid this? I think about session. right? but how to integrate session in extJS or rails?

  • 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-05-21T07:38:15+00:00Added an answer on May 21, 2026 at 7:38 am

    Yup, you though correctly, you need to use session. If you are beginner read about session management. RoR related session details can be found here.

    When you login for the first time, if the user provided the correct information.. you need to create a session and store some info into it(for validating the session). When the use hit the URL again, first you need to check if the session is valid or not. If valid, you can simply forward the user to the application home page. Otherwise, the login page is displayed again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a solution that uses webforms for front end & mvc for admin
Background I have a couple of projects that use a SQLite DB for data.
In VS 2010, I have a post-build event copying project assemblies into a common
I have a login control in login.aspx page that validates user by checking in
I have control, subclassed from CDialogBar, it has some buttons(like on toolbar). When I
In WinForms, you have Control.BeginInvoke() , which means you can marshall a call from
I want to read UTF-8 strings from a server that I have control of,
I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
I have this control (see picture). I like when check one option in this
I have a control displaying text, but somehow the text appear to be all

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.