Coder Social home page Coder Social logo

Comments (7)

mikker avatar mikker commented on May 20, 2024 1

Something like this...

# registrations_controller.rb
include Passwordless::ControllerHelpers

def create
  user = User.new(email: params[:email])

  if user.save
    pwless_session = build_passwordless_session(user)
    pwless_session.save!

    YourOwnRegistrationsMailer.signup(token: pwless_session.token).deliver_now
    # ... redirect back or whatever
  end
end

from passwordless.

no1-knows avatar no1-knows commented on May 20, 2024

Did I make myself clear? Let me explain more.

I would like to make the flow, from signup to signin, like slack.
The flow like below.

  1. Input email for signup.
  2. check email and click.

Could you let me know how to do this?
I think it will work if I could use module Passwordless properly...but I didn't.

As far as I know, this gem has 2 flows.

First: It is a pain in input twice.

  1. Input email for signup.
  2. Input email for signin.
  3. check email and click.

Second: It is not good for security because the email might not valid.

  1. Input email for signup and signin.(using sign_in @user)

from passwordless.

no1-knows avatar no1-knows commented on May 20, 2024

Thank you for your help!!
I did it like below!

def create
  @user = User.new(user_params)

    respond_to do |format|

      if @user.save
        pwless_session = build_passwordless_session(@user)
        pwless_session.save!
        RegistrationMailer.with(token: pwless_session.token, user: @user).welcome_email.deliver_now
        # ... redirect back or whatever
  end
end

from passwordless.

no1-knows avatar no1-knows commented on May 20, 2024

I want you to add this way at README.md if you can.
Anyway, please enjoy a cup of coffee, maybe for one year!!

from passwordless.

fa11enangel avatar fa11enangel commented on May 20, 2024

This is wrong

I've deleted the message due to wrong content - some local issue on my machine.

from passwordless.

mikker avatar mikker commented on May 20, 2024

I'm not sure that's right. save! calls callbacks: https://guides.rubyonrails.org/active_record_callbacks.html#running-callbacks

from passwordless.

fa11enangel avatar fa11enangel commented on May 20, 2024

You are right, but this is a case for my small test project using your gem. I'll create a new issue with all information.

from passwordless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.