Devise - LogIn parameters invalid email and password - ruby-on-rails

I am new to RoR and I used devise gem for authentication.
I have a login form which is created by command "rails g devise:views"
If I change the form_for(:session,.......) it shows invalid email and password and if I change to form_for(:user,......) it is working.
Questions:
1)Why only user resource not any other resource or controller because the first parameter is for only use for params i.e, params[:session][email].
2)Where is it documented in Devise gem docs?
Can anyone please help me with this issue ?
Thanks in advance !!!!Sorry for silly doubt!

Related

Register with a username using Ruby on Rails Devise Gem

Using Devise Gem, I was able to sign in and register via email, but how can I login with username?How can I add validation to a username?
Check devise wiki, should be enough to solve this.
https://github.com/heartcombo/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address

how to create login form using ruby on rails in ruby mine?

How to create a login form using ruby on rails in rubymine?? i want fields such as username and password and a submit button.when the user clicks submit button username and password must be checked against a mysql database.if the username or password don't match then there must not be login but if the username and password do match it should be redirected to a page. how to do this??
One of the best methods to authenticate a USER against Username and Password :
1. Authlogic
RailsCast : Authlogic
RailsCast : Authlogic : Asciicast
2. Devise
RailsCast : Devise
Learn Ruby on Rails from Ruby On Rails Tutorial
See the sign in section in the same tutorial

Rails + Devise + API + User Registration

I am new to ruby and rails and so far I managed to setup user management using devise. Right now I am trying to integrate support for mobile Android and iOS apps. So far it is possible for them to login and logout and get an authentication token. But in addition to that I would also like them to be able to register.
Now, as I understand it I have to do a post to
http://localhost:3000/users/sign_up
How does this post look like? And how do I get a JSON response? I found this on stackoverflow.
"utf8=✓&authenticity_token=n5vXMnlzrXefnKQEV4SmVM8cFdHDCUxMYWEBMHp9fDw%3D&user[email]=asd%40fasd.org&user[password]=321&user[password_confirmation]=1233&commit=Sign+up"
Unfortunately this does not work - I am getting the message "Bad request". I also do have a couple of questions about this example. What is the authenticity_token for? How do I get one? This is not the devise token authentication I guess as the user is not even in a position to have one at this point.
Also, after a successful login I would like to bundle the "registration successful" message with a generated devise authentication token. So I guess I have to somehow extend devise`s existing registration controller.
Thank you very much in advance!
Devise already has all this setup. Based on your signup path, I infer that you mounted Devise onto http://localhost:3000/users. Devise includes all the controllers and views that are required, including the log in form, the sign up form, the email confirmation form and the password reset forms.
GET http://localhost:3000/users/sign_up is actually a form for users to signup at. The form on that page will POST to http://localhost:3000/users/, which goes to Devise's registration controller's create action.
Assuming there is no action/view already at /users/sign_up, the sign up form should be there, go check if it is there (assuming you set up devise_for correctly in your routes.rb file).

Devise access params in Devise sessions view

I'm on Rails 3.0.9, Ruby 1.9.2, Devise 1.3.4
URL to an authenticated Devise resource for my app, e.g.,
http://myblog.com/article/5?type=blah
This will cause Devise to redirect to a login page. I have a need on Devise login page, sessions#new.html.erb, to conditionally display a drop down depending on type and I have no idea how to access it from sessions#new.html.erb. I tried params and that didn't work, ideas?
I found a workaround, Devise stores that info in a session variable
session[:user_return_to]
Hope this helps someone else out of a jam if they need to do the same thing

Can't login using devise, migrating from restful_authentication

I already migrating from restful_authentification to devise.
I follow every steps. I succeed sign up new user, confirm it.
also login with it's user. Everything is going right.
Until I found a bugs. That some of current user who already able to login with restful_authentification,
cannot login. It returns "Invalid username and password".
It is possible the reason is coursed from different password encryption system between restful_authentification and devise?
Or Devise didn't allow some characters on password?
Please help me? Its already 2 days find ways to resolve the issue
Thanks
Did you configure Devise to use the :restful_authentication_sha1 encryptor, the correct pepper and stretches? See https://github.com/plataformatec/devise/wiki/How-To:-Migrate-from-restful_authentication-to-Devise
I do not know restful_authentication, but i think you will have to reset the passwords of all the users that existed before. It is safe to assume that devise uses a different algorithm to encode the password.
When resetting the password from the console, you need to specify the :password and the :password_confirmation, otherwise it will not work.

Resources