简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM