lynndylanhurley / lynndylanhurley/devise_token_auth

Email can't be blank. How to create a user with blank email?

Open
#1,516 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I can't create the user if the email is nil or blank even the email field is not a required field in the database.
Bit if I remove `include DeviseTokenAuth::Concerns::User` from the user model I can create with a blank email.

* **Version**: 1.1.5
* **Rails Stacktrace**:
```
2.7.2 :004 > User.create!(first_name: 'a', last_name: 'b', password: '1234qwer', password_confirmation: '1234qwer')
TRANSACTION (0.9ms) BEGIN
User Exists? (1.7ms) SELECT 1 AS one FROM "users" WHERE "users"."email" IS NULL AND "users"."provider" = $1 LIMIT $2 [["provider", "email"], ["LIMIT", 1]]
TRANSACTION (0.4ms) ROLLBACK
Traceback (most recent call last):
2: from (irb):3
1: from (irb):4:in `rescue in irb_binding'
ActiveRecord::RecordInvalid (Validation failed: Email can't be blank)
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the User model and the DeviseTokenAuth::Concerns::User concern, reproducing the shown User.create! call with a nil or blank email. Trace the email validation and determine the intended behavior for users without email addresses; done means the behavior is resolved or clearly documented and covered by a focused test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
authentication, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.