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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:15:11+00:00 2026-06-11T22:15:11+00:00

This has been asked before to some degree but I couldn’t find an actual

  • 0

This has been asked before to some degree but I couldn’t find an actual answer: How can I allow my users to log in via the same form they signup? This is a client request/demand by the way, I realise this is far from ideal…

User

class UsersController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      sign_in @user
      render :json => @user.to_json(:only => [:id])
    else
      render :json => @user.errors, :status => ""
    end
  end
end

Session

class SessionsController < ApplicationController
  def create
    user = User.find_by_email(params[:session][:email])
    if user && user.authenticate(params[:session][:email])
      sign_in user
      render :json => @user.to_json(:only => [:id])
    else
      render :json => @user.errors, :status => ""
    end
  end
end

Form

<%= form_for(@user, :html => { :class => "access"}) do |f| %>
    <%= f.label :firstname, "Firstname" %>
    <%= f.text_field :firstname, :placeholder => "Your firstname" %>
    <%= f.label :surname, "Surname" %>
    <%= f.text_field :surname, :placeholder => "Your surname" %>
    <%= f.label :email, "Email Address" %>
    <%= f.text_field :email, :placeholder => "Your email address" %>
    <%= f.submit "Verify" %>
<% end %>

Emails are validated as unique, could that be an entry point? Eg. If the email is not unique check the name and email or something.

I have no idea how to go about this.

  • 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-11T22:15:12+00:00Added an answer on June 11, 2026 at 10:15 pm

    My suggestion is to make another controller which is something like AccessController. It should use a name that means both login and register, Access was just all I could think of. That controller should be able to do a check on the login credentials and either login or register.

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

Sidebar

Related Questions

Sorry if this has been asked before, but I couldn't find a good example
I'm sure this has been asked before, but I can't seem to find it
I apologise if this has been asked before but I can't find the info
Sorry if this has been asked before, I did check but couldn't find anything...
I'm pretty sure this has been asked before but I can't seem to find
Sorry if this has been asked before, I searched but couldn't find anything. I'm
I know this has been asked before, but I did not find its answer
I know this has been asked before but I can't find it so... Say
I suspect this has been asked before, but can't seem to find a question
I know this has been asked before but I needed some clarification and confirmation.

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.