Questions tagged [clearance]

Clearance is a Ruby gem for authenticating users with email and password in Rails apps.

Clearance is a Ruby gem for authenticating users with email and password in Rails apps. https://github.com/thoughtbot/clearance

112 questions
24
votes
8 answers

Removing or overriding an ActiveRecord validation added by a superclass or mixin

I'm using Clearance for authentication in my Rails application. The Clearance::User mixin adds a couple of validations to my User model, but there's one of these that I would like to remove or override. What is the best way of doing this? The…
Theo
  • 131,503
  • 21
  • 160
  • 205
7
votes
1 answer

'current_user' undefined in rails_admin with clearance

I've been using rails_admin v0.7.0 with the clearance gem successfully up this point. I tried to update rails_admin to v1.0 today, but am getting an undefined variable or method error for current_user. In v0.7.0 it appears that…
swraife
  • 93
  • 2
  • 5
5
votes
2 answers

Facebook auth for a Rails app using Clearance?

I'm writing a Rails 3.1 app, using Clearance for auth. I want to add standard Facebook auth: allow users to continue to register/authenticate with us directly (using Clearance) or via FB; if they sign in/register via FB and we already have an…
Steve Bourne
  • 951
  • 8
  • 19
5
votes
1 answer

How do you invite another user to a "team" or "account" or "project" with Clearance and Pundit?

I have a Rails app with Clearance and Pundit and I'm trying to create "teams" where the "Team Leader" can invite other users to join their team. I would like to do something similar to devise_invitable, but with Clearance. Here is my plan for how…
Lee McAlilly
  • 9,084
  • 12
  • 60
  • 94
5
votes
2 answers

Cucumber and Clearance: current_user in steps

What I what to accomplish is to use (rely on) current_user method while defining Cucumber steps. I'm using Clearance in my project. First of all I tried to use sign_in but it didn't work (I guess Cucumber World doesn't know about Clearance…
oldhomemovie
  • 14,621
  • 13
  • 64
  • 99
3
votes
2 answers

How to add privleges/roles to Clearance gem?

I have the basic clearance setup - rails generate clearance:install and rails generate clearance:views In my admin_controller, I have before_filter :authorize This makes sure the user is logged in. How would I setup 'admin' privileges on my…
andrewpthorp
  • 4,998
  • 8
  • 35
  • 56
3
votes
1 answer

Clearance: change user password

I am using gem clearance for user authentication, but now I encountered problems with implementing a 'change password' link. This is what I have: ... but in…
IvanSelivanov
  • 710
  • 5
  • 15
3
votes
1 answer

Rails: force specific id for new record (or change id of existing)

Due to an error that deleted a user in our Rails app I'm trying to force another user record into the old records ID. $ rails console > User.find(2) ActiveRecord::RecordNotFound: Couldn't find User with 'id'=2 > replacer = User.find(5) => #
Meltemi
  • 37,979
  • 50
  • 195
  • 293
3
votes
2 answers

rails 4 and thoughtbot/clearance - adding fields to the user model

I am a relative newbie so would really appreciate any assistance. I'm using Rails 4.2, with the Clearance gem for authentication. I'm hoping someone could describe the best practise for over-riding the controllers to include custom attributes on the…
2
votes
1 answer

How do I sign in a user in Clearance from a custom router?

I'm adding Omniauth to my app where I'm using Clearance for regular authentication. I've run into a wall trying to sign in a user programatically. I'm looking for something like sign_in_and_redirect from Devise, but can't find it in Clearance. I've…
Misha M
  • 10,979
  • 17
  • 53
  • 65
2
votes
0 answers

Clearance + Shoulda Matchers not loading on RSpec

I added the following lines to my spec_helper.rb file require 'clearance/testing' require 'clearance/shoulda_macros' config.include Clearance::Shoulda::Helpers But I'm getting the following…
thoughtpunch
  • 1,907
  • 4
  • 25
  • 41
2
votes
1 answer

Clearance and 2FA (or MFA)

I'm using Clearance for authentication on my Rails app. More and more of my users ask me to implement some kind of 2 Factor Authentication. I am thinking that when signed in, users could opt-in to use 2FA instead of logging with e-mail and…
edouardbriere
  • 1,170
  • 8
  • 12
2
votes
0 answers

current_user nil while using omniauth with clearance

This is my sessions controller class SessionsController < Clearance::SessionsController include ActionView::Layouts include ActionController::Flash def create user = AdminUser.find_or_create_from_auth_hash(request.env['omniauth.auth']) …
SureshCS
  • 1,005
  • 12
  • 23
2
votes
0 answers

Issues with Rails API mode with Clearance gem?

I have followed the steps here https://github.com/thoughtbot/clearance/wiki/API-Authentication (inserted below) to get my Rails API only app going with authentication. I have run into a couple issues. The first being that "cookies" is undefined.So I…
superstar3000
  • 389
  • 5
  • 16
2
votes
1 answer

How to get the authentication status in clearance for tests

The first rails app I wrote used the hand-rolled authentication from railstutorial. For my second app I'm using Clearance. I'm trying to write the integration tests for whether clicking the sign in/sign out links have worked. In the railstutorial…
Nick
  • 2,418
  • 16
  • 20
1
2 3 4 5 6 7 8