Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

If user exists redirect to refer-a-friend page #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

billybonks
Copy link

Sometimes people use a different computer or cleared cookies. For what ever reason the cookie is not there, they want to see their progress or fetch referral link. This pr adds a before_action :create method that will redirect them to the page if they subscribed before. previously a create error would be thrown on user.save

it also changes the email to lowercase, user that sign up with mobile browser often use Capitalised, emails, so it is important, to lowercase them for this feature to work.

i also fixed a deprecation

if user already exists redirect to refer and update cookie
it also changes the email to lowercase, user that sign up
with mobile browser often use Capitalised emails, so it is important,
to lower case them for this feature
email = params[:user][:email].downcase
params[:user][:email] = email
user = User.find_by_email(email)
if not user.nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a truthy version of this? possibly user.exists?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, while i'm not the maintainer, i'm sure it'd be appreciated if there was a unit test or two for this :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense thanks for the review, i would like someone with merging powers to let me know if they would be happy to merge this in before adding more code :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants