Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise Custom login form

Is there any way to point the Devise authenticator at my custom login form? The standard, unstyled form is unusable (Fields missing, throws exceptions on submit, actually crashed my runtime once.) and just not good looking. I have a 100% usable form, one that actually logs people in, but if a mistake is made, the standard form shows up, also lacking an error message. Something like "When asked to present a login form, render /views/sys/login.html.erb, and on error, return to that view and put in error message" NOTE: I have already tried the below, from a different question

devise_for :users, :path => '', :path_names => {:sign_in => "system/login", :sign_out => "logout", :sign_up => "register" }

and this simply overwrites my form

(My /system/ from HTTP gets files out of the /sys/ views directory, so http://localhost:3000/system/login would render /views/sys/login.html.erb)

EDIT: Never developed a rails app that uses login or authentication with web forms (Only the standard HTTP authentication)

like image 245
Rebecca Avatar asked Oct 08 '12 02:10

Rebecca


1 Answers

You can move devise views to your views directory using the following command (from your rails project root):

rails g devise:views

this it will create devise directory in your app/views/. There you will get all of it's views and you can customise it as you prefer. For customising the login form, you need to modify the sessions/new.html.* file. * may be .erb or .haml or something else

like image 85
HungryCoder Avatar answered Nov 16 '22 14:11

HungryCoder