devise

Devise: Update Account without password confirmation

左心房为你撑大大i 提交于 2019-12-25 08:42:01
问题 I know that on Devise wiki pages they explain how to do it here: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password But I am new at Rails(4) and I am trying to do it for hours but I keep receiving the "password can't be blank message'. Can anyone explain how o do it for rails 4? Updated: here is my code, I create a file in controllers called Registrations with this code: class RegistrationsController < Devise:

rails 3 authentication

允我心安 提交于 2019-12-25 08:36:07
问题 i'm currently buidling my own blog using rails 3. and use devise gem for authentication. the problem is , i want only one user out here --- the admin user, and prehibits others from signing up, how can I achive that? 回答1: Is there any reason why you can not use Basic Http Authentication? IMHO devise seems to be an overkill for this usecase. 来源: https://stackoverflow.com/questions/3766601/rails-3-authentication

accessing current_user in mailboxer mailer notification

南笙酒味 提交于 2019-12-25 08:15:23
问题 I'm trying to print user name into a mail template which has been created via rails g mailboxer:views. Whenever I try to call the method, raises an "method or variable current_user not found", although public methods as User. id do prints. Here's the view <!DOCTYPE html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> </head> <body> <h1>You have a new reply from <%= current_user.name %>: <%= @subject %></h1> <blockquote> <p> <%= raw @message.body %> </p> <

RSpec: Authenticating before test with devise_auth_token

社会主义新天地 提交于 2019-12-25 07:49:10
问题 I am using devise_auth_token to authenticate users for an API. I would like to authenticate users before each test is run, but keep getting a 401 error. When I use postman to the endpoint with the correct headers, it works, but fails to work during tests. before(:each) do @user = FactoryGirl.create(:user) end def get_auth headers = @user.create_new_auth_token auth = Hash.new auth["client"] = headers["client"] auth["access-token"] = headers["access-token"] auth["uid"] = headers["uid"] auth[

Rails Devise - Update column from another controller

六月ゝ 毕业季﹏ 提交于 2019-12-25 07:00:37
问题 Rails 3.0 Following these instructions: https://github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in I've generated a migration :approved (boolean) for my devise user.rb. Now I want to edit it with a checkbox from a different controller: unapproved_users_controller.rb. When I load the form in the edit I get this error: undefined method `user_path'. routes.rb , the resources for my new controller resources :unapproved_users app/models/user.rb , notice

Rapidfire and Devise

人盡茶涼 提交于 2019-12-25 04:22:40
问题 I implemented Devise and went through the instructions to install Rapidfire and for the application controller I have def current_user current_user #rb:7 end def can_administer true # just for right now... end but on the page I get a something went wrong and if I look in the console it says ActionView::Template::Error (stack level too deep) app/controllers/application_controller.rb:7 which is the current_user line. Can anyone tell me whats going on? 回答1: You are creating a method called

Adding devise gem to a Rails 4 / mysql project (table users already exists)

*爱你&永不变心* 提交于 2019-12-25 04:19:12
问题 I'm a total newbie with Ruby, Rails, Rake, MySQL (on Ubuntu/bash/command line) and devise (warden 1.2.3, devise 3.0.4). I must continue with what have been done so far : the Rails 4 project is working and linked to a MySQL database (full, populated with users and data). I'm able to change controllers and views. I must add devise to the project. I'm reading this : https://github.com/plataformatec/devise . My class name is User . So I did rails generate devise User . When I do rake db:migrate I

Failed to load resource 401 unauthorized only with Safari

别说谁变了你拦得住时间么 提交于 2019-12-25 04:04:52
问题 I'm found an interesting problem in my app. I'm using Rails 3 with ruby 2.0. I already have a production server where my app is running and another staging server. I'm configuring a new better one but I have a problem only with Safari. Redirected to http://ip.server/ Completed 302 Found in 201.7ms (ActiveRecord: 0.0ms) Started GET "/" for my.ip at 2014-10-13 08:17:18 +0200 Processing by DashboardController#index as HTML Completed 401 Unauthorized in 1.2ms Started GET "/user/sign_in" for my.ip

Using Devise in Rails 3.2.3 - Cannot sign out

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 04:02:42
问题 I am using devise 2.1.0 for my rails app 3.2.3. Here is what I did: Add gem 'devise' to Gemfile and run bundle Run rails g devise:install Run rails g devise User Setup db by running rake db:migrate The application.html.erb is something like this: <%if user_signed_in? %> Welcome <%= current_user.email%> <%= link_to "Sign out", destroy_user_session_path%> <% else %> <%= link_to "Sign up", new_user_registration_path %> or <%= link_to "Sign in", new_user_session_path %> <% end %> The sign in and

Devise after_sign_in_path_for works, but not the other ones

此生再无相见时 提交于 2019-12-25 03:56:26
问题 I'm really missing something here. I have read many things about devise redirects (seems like it is hard to implement for most people ...) but in my case I really don't get it. Sometimes I read that the methods after_<action>_path_for(resource) should be in the ApplicationController , sometimes it is mentionned to be in a specific controller, overriding the devise one. I'd rather have them in my ApplicationController since it bothers me to create more Controllers just for a redirect, but if