Questions tagged [clearance]
Clearance is a Ruby gem for authenticating users with email and password in Rails apps.
112
questions
0
votes
0
answers
12
views
How can I store Clearance session in a session storage instead of a cookie in Ruby on Rails?
I have a requirements in our application:
User has to be logged out after the browser window is closed.
User has to be logged out after 15 minutes of inactivity
I was able to meet the first ...
1
vote
1
answer
64
views
How do I set the port correctly in email links during a system test?
I'm writing a System test to confirm the entire sign up flow is working in a Rails 7 app (with the Clearance gem and an email confirmation SignInGuard).
The test is working fine right up until I "...
0
votes
1
answer
52
views
How to correctly apply CSS styles to HTML element Clearance templates? (Ruby On Rails)
I'm using bootstrap 5 for fastest applying styles, but when I trying to apply styles for HTML element template, I have this:
Before applying
After applying
Code (.html.erb):
<div class="...
0
votes
0
answers
40
views
User object is sometimes nil in Clearance SessionsController after successful sign in
I've assumed that if status.success? is true then I could rely on @user being present. But sometimes I get an error that @user is nil.
How is it possible that the reference to @user within #...
0
votes
1
answer
42
views
Verifying user is authorized after using redirect_back
I have a method that creates a new user session and will redirect back to the previous screen after successful login. It has introduced a security issue where someone can type in a url navigate to a ...
0
votes
1
answer
27
views
Overwrote thoughtbot/clearance user.rb not working
I wanted to add a new Boolean attribute to my user: is_student
My project has 2 types of users: students & faculty. If is was a student is_student should be true and if it is faculty is_student ...
-1
votes
1
answer
247
views
Show user id/name in Rails log with Clearance gem
I'm looking for a way to show the current user on each line in the Rails logs. E.g.
[johndoe] Started GET "/" for 127.0.0.1 at 2020-06-07 01:10:33 +0000
Some research suggested using the rails config....
1
vote
0
answers
125
views
Extending Rails ThoughtBot/Clearance gem for password rotation
I love the ThoughtBot Clearance gem (https://github.com/thoughtbot/clearance) for Rails authentication. But I'd like to expand my knowledge base in what/how I can make it more-better :)
I've used ...
2
votes
1
answer
353
views
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 ...
1
vote
1
answer
66
views
How to set Session length for a User in Clearance?
How do I kill the session cookie for a user that closes their browser and or a day passes in Clearance?
I do see the following config vars, but I believe the cookie expiration is for the general ...
0
votes
1
answer
40
views
How to display a user's posts only. Not others
This app is for tutors. When a tutor finishes a class, they fill out a class_report. Then the index page should display only their class_reports.
Here's my problem: I've made two accounts, test1 and ...
1
vote
0
answers
64
views
404 error when submitting forms / chat messages
I'm very new at Ruby on Rails and I'm trying to follow this tutorial (https://scotch.io/tutorials/asynchronous-chat-with-rails-and-actioncable?fbclid=...
1
vote
1
answer
218
views
BCrypt InvalidHash with Clearance password resets
I'm new to Rails, coming from a PHP + Python background. I'm setting up a development environment on my machine based on a production database dump.
I can't log in to my dev environment because every ...
2
votes
0
answers
175
views
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....
1
vote
0
answers
76
views
Clearance login and login redirect breaks after upgrading from Rails 6 beta1 to Rails 6 beta 2
I'm using the Clearance gem for authentication on an app that I started new with Rails 6 beta 1. Everything was working fine, but when I tried to upgrade to Rails 6 beta 2.
I've also tried the ...
0
votes
1
answer
125
views
How to set up password reset emails from gmail with clearance?
I'm trying to create a clearance password reset email to send from a gmail account I created. What do I have to do to accomplish this and send the password reset email when someone clicks "reset ...
0
votes
1
answer
154
views
How to lock down an entire Rails app until a User completes their account set up
I have a rails app that uses the Clearance for signup and login. After signup the user is redirected to accounts/new to complete their account setup. The Account belongs_to User and the user has_one ...
1
vote
1
answer
364
views
Modeling a multi-tenant rails app so that it's easy to maintain
I'm building a multi-tenant rails app that is using a shared database where data is siloed by scoping everything to each account (similar to Basecamp 3)—rather than with separate tables and subdomains....
0
votes
0
answers
96
views
How to override method url_after_denied_access_when_signed_out in rails using clearance lib to change redirect url?
I am using clearance library for my ruby on rails application auth, but I need to customize view with my template login, I already override sessions method like this and it works but not for ...
0
votes
1
answer
66
views
How to create an account when and assign it to a User when signing up via Clearance in rails
What is the best way with Clearance to automatically create a an "Account" with a unique account_id (doesn't have to be UUID) and assign it to the new user on sign up?
I need to extend the clearance ...
1
vote
1
answer
205
views
Clearance Gem | Expire a Session after Closing the Browser in Rails 5?
How do I automatically sign out when the user closes the browser ? Is there any configuration changes in clearance gem that would enable this.
2
votes
0
answers
226
views
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....
1
vote
1
answer
339
views
Is it possible to seed users into the DB with the Clearance gem?
I'm working on a Ruby-on-Rails project using the Clearance gem for authentication. Is there a way to use the seeds.rb file to seed users into my database, or do I have to manually create users on the ...
5
votes
1
answer
439
views
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 ...
1
vote
1
answer
735
views
How to test a password reset mailer with Capybara and Minitest in Rails 5
I'm using the Clearance gem in Rails along with Capybara and Minitest and I can't figure out how to test the password reset mailer. I'm not trying to test the Clearance gem, which is already well-...
0
votes
0
answers
68
views
Adding additional signup fields to Clearance
I'm new to rails, and I'm using the clearance gem for authentication. https://github.com/thoughtbot/clearance
It works great with the email, and password fields. But how would I add extra fields such ...
1
vote
2
answers
47
views
Feature: User updates her email address
Is there a canonical way to build an “update email” feature on top of the Clearance gem?
To spell it out: I want a logged in users to be able to visit the site and update the email address associated ...
1
vote
0
answers
141
views
ActionView::Template::Error (First argument in form cannot contain nil or be empty): rails 5
I get the error ActionView::Template::Error (First argument in form cannot contain nil or be empty): when I click on the sign up link. I created a form partial which I then render on the new.html.erb ...
1
vote
1
answer
42
views
Clearance - different URLs for text & html confirmation emails
I am using clearance for authorization and am running into an issue where the text and html email confirmations that go out to potential new users have different confirmation urls - the text one works ...
1
vote
1
answer
702
views
How to lock out user in clearance after X failed login attempt?
I'm using Rails 5 and clearance 1.16.0.
When user attempts loggin in for 4 times I would like to show them a mesaage saying they are now locked
if user.failed_attempts > 3
user.lock = ...
0
votes
2
answers
457
views
ForbiddenAttributesError With Clearance
I am using clearance for signup and have a couple extra attributes beyond email and password that are in the signup form including first_name, last_name, role, and university conditional on if role is ...
0
votes
0
answers
239
views
Access user object in doorkeeper
I'm trying to use clearance with doorkeeper and from the doorkeeper documentation, I have to access the User object like so:
resource_owner_authenticator do
@user = env[:clearance].current_user
...
0
votes
1
answer
171
views
How do disable email validation in Clearance
I'm trying to get Clearance to work with AWS Dynamo as the back-end store. The problem I'm having is that I can't get Clearance to not do the email-uniqueness validation, which it can't do because it'...
0
votes
1
answer
73
views
Authenticating engines using Clearance in main app
Context
I want to run several rails applications on the same server, by implementing them as engines in a main application. The main application should contain authentication logic, such as users and ...
1
vote
1
answer
278
views
Rails 5: Clearance - User CRUD?
I am currently using https://github.com/thoughtbot/clearance
for authentication.
It allows me to sign-up & sign-in using password and email.
But I was wondering how I can configure it to have a ...
0
votes
1
answer
130
views
Clearance failure when forbidden password reset
I’m using clearance and love it, but I'm having trouble resetting passwords. I type in my email to reset the password, which works, but then when I try to navigate to the edit password page using the ...
1
vote
1
answer
328
views
Clearance gem redirect issues
Hello I'am using clearance gem for user authentication.
So far everything works perfect, but I'am confused why even after setting the root routes for my pages index view, it still redirects me to the ...
2
votes
1
answer
563
views
Rails 5 API app returning white screen with Devise sign_in page
I am working on a Rails 5 API only app using JWT tokens.
I'd like to use Rails Admin for internal processes and would like to configure Devise (or Clearance) for auth for staff members instead of ...
0
votes
0
answers
167
views
Rails. Rewrite clearance controllers
I try add js in clearance controllers. Users-controllers rewrite ok, but sessions and passwords controllers not work.
user_controller (work):
class UsersController < ApplicationController
def ...
1
vote
2
answers
686
views
Rails Clearance, Unit Test Controller
I'm having trouble getting the Clearance authentication to work with Rails controller unit testing. I've followed the instructions at https://github.com/thoughtbot/clearance "Controller Test Helpers". ...
0
votes
1
answer
45
views
Rails 5 Geolocation with Clearance
I'm currently using Clearance for authentication. As part of the login process I want to ensure that I have a location for the user (stored in the session).
My question is how to do this in the ...
0
votes
1
answer
148
views
Clearance gem not displaying flash messages (Ruby on Rails 5.0.1)
How do I display flash messages when using the clearance gem for user authentication?
I have this code set in my view/layouts/application.html.erb inside the body tags:
<% flash.each do |key, ...
0
votes
2
answers
130
views
Rails - Deploying to Heroku with duplicate routes
I'm deploying my Rails app that uses the clearance gem to Heroku. Everything works fine in development but I'm running into trouble with the gem generated routes I get.
When attempting to deploy to ...
0
votes
1
answer
93
views
Adding extra data into Clearance cookie?
I'm using Clearance for authentication in a Rails 5 app, and I'm wondering what the best way to store important (to the app) user data? Right now I'm storing it in the session by overriding Clearance::...
7
votes
1
answer
2k
views
'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....
0
votes
2
answers
410
views
Unable to log out of clearance gem
I have recently move my project away from the somewhat bloat devise to clearance, though I am experiencing troubles when attempting to log out
I am currently get the error of the route not existing
...
2
votes
0
answers
38
views
Clearance gem not always rendering the correct layouts
I am currently using the Clearance gem by thoughtbot have noticed when trying to get the different controllers to render a different layout that not always does it render the correct layout, it ...
1
vote
0
answers
901
views
undefined method `edit_user_password_url'
I am trying to do forgot password using clearance but getting this error ???
undefined method `edit_user_password_url' for #<#<Class:0x00000003898f98>:0x00000003757d50>
At this line
<...
0
votes
0
answers
51
views
unable to use CustomValidators with Clearance gem
We have recently started to use the Clearance gem, but are running into a few issues whereby my custom validations are no longer working
Validations
validates :first_name, presence: true, if: :...