devise

ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

有些话、适合烂在心里 提交于 2019-12-31 10:04:10
问题 My ruby on rails action mailer runs all good in development environment, but in production environment, it keeps throw: ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true My development config is config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :port => xxx, :address => 'smtp.example.org', :user_name => 'xxx@example.com', :password => 'xxxxxxxx', :domain =>

Rails : Adding an admin role using devise who can see all the users

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-31 01:50:16
问题 I need to create an admin role using devise for my app. I've created basic authentication using devise . I have a devise user model in my app but now i need an admin who can show edit and destroy all the users. I tried following the tutorials but none of them helped. I am using rails 3.0.10 and ruby 1.9.2-p290. 回答1: You just define role.rb first by creating migratioin rails g model role name:string then in role.rb class Role has_one:user end And in user model class user belongs_to :role end

Devise: Registering log in attempts

断了今生、忘了曾经 提交于 2019-12-31 01:17:11
问题 I have a Rails 3.0 project using devise and I've been requested to register in DB every succesful login and every failed attempt. From the devise documentation I think I'd have to extend FailureApp but the examples are just redirecting users and not using the model at all. In stackoverflow I've just found this question but it remained unanswered, which is not encouraging Can anyone tell me if I'm correct in this approach or it can't be done this way, or if there is some easier alternative I'm

How to put a login form in the header for Devise and Rails

烈酒焚心 提交于 2019-12-30 10:39:50
问题 I want to put a login form in the header of my website. I use Rails 3.2.8 and the latest Devise. In the app/views/devise/sessions/new.html.erb file a login form is created with: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'main'}) do |f| %> <div><%= f.label :login %> <%= f.text_field :login, :placeholder => 'Enter username' %></div> <div><%= f.label :password %> <%= f.password_field :password, :placeholder => 'Enter password' %></div>

How to put a login form in the header for Devise and Rails

╄→гoц情女王★ 提交于 2019-12-30 10:39:28
问题 I want to put a login form in the header of my website. I use Rails 3.2.8 and the latest Devise. In the app/views/devise/sessions/new.html.erb file a login form is created with: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'main'}) do |f| %> <div><%= f.label :login %> <%= f.text_field :login, :placeholder => 'Enter username' %></div> <div><%= f.label :password %> <%= f.password_field :password, :placeholder => 'Enter password' %></div>

Devise omniauthable breaks Omniauth authentication with `Could not find a valid mapping for path`

蓝咒 提交于 2019-12-30 10:30:37
问题 In my project, I have two type of users: job seekers and hiring managers. Job seekers don't have a model, they are just able to apply for jobs using the data received from from third-party providers while authenticating thru Omniauth. Hiring managers' info is stored in devise User model. Hiring managers also must be able to sign in with their company's Google email account. So, first I built job seekers' authentication using Omniauth 1.0.0, Rails 3.1.3: omniauth.rb require 'omniauth-openid'

rails csrf validation in firefox

拈花ヽ惹草 提交于 2019-12-30 10:28:05
问题 I have a site created with Rails using Devise for authentication. It works perfectly fine in Chrome, but in Firefox I cannot log in. All I can see is a message in log: WARNING: Can't verify CSRF token authenticity And the login screen comes back without any error messages. Can someone give me a hint where to look after what is happening? 回答1: I had exactly the same problem. Login was working in Chrome and not in FF. The problem was not related to CSRF since I commented out protect_from

rails csrf validation in firefox

前提是你 提交于 2019-12-30 10:28:04
问题 I have a site created with Rails using Devise for authentication. It works perfectly fine in Chrome, but in Firefox I cannot log in. All I can see is a message in log: WARNING: Can't verify CSRF token authenticity And the login screen comes back without any error messages. Can someone give me a hint where to look after what is happening? 回答1: I had exactly the same problem. Login was working in Chrome and not in FF. The problem was not related to CSRF since I commented out protect_from

Newly added column's data not being saved to DB

烂漫一生 提交于 2019-12-30 07:25:19
问题 I am using Devise for user authentication in my Rails 4 app. Recently I added two new columns to the User model. They are first_name and last_name. I then updated the signin form with fields for both of these attributes. However, neither are being saved to the database when I test creating a new user. I thought it might be a mass assignment problem but I'm not getting any kind of database error. The user is successfully created but only the original attributes (email, password, and password

Allowing users to edit accounts without saving passwords in devise & passing conditions to :reject_if in Ruby

余生颓废 提交于 2019-12-30 05:34:05
问题 I am working on a ROR app, and I'm stuck when it comes to Devise and password confirmation. I'd like for my users to be able to edit their information (name, location, etc) without having to enter and confirm their password (that is unless they decide to change their password, in which case, these fields would be required.) I did a bit of reading when it comes to devise and I noticed that this is a common issue. Unfortunately, I tried all of the solutions posted on the devise GitHub repo, but