Skip to content

Commit

Permalink
Remove obsolete .mounted_as, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mikker committed Jun 19, 2023
1 parent d6e8a34 commit 2f97a19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ By default, Passwordless uses the resource name given to `passwordless_for` to g

```ruby
passwordless_for :users
# <%= users.sign_in_path %> # => /users/sign_in
# <%= users_sign_in_path %> # => /users/sign_in

passwordless_for :users, at: '/', as: :auth
# <%= auth.sign_in_path %> # => /sign_in
# <%= auth_sign_in_path %> # => /sign_in
```

Also be sure to [specify ActionMailer's `default_url_options.host`](http:https://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views).
Expand Down Expand Up @@ -204,13 +204,13 @@ Currently there is not an officially supported way to generate your own magic li
However, you can accomplish this with the following snippet of code.

```ruby
session = Passwordless::Session.new({
session = Passwordless::Session.create!({
authenticatable: @manager,
user_agent: 'Command Line',
remote_addr: 'unknown',
})
session.save!
@magic_link = send(Passwordless.mounted_as).token_sign_in_url(session.token)

@magic_link = users_token_sign_in_url(session.token)
```

You can further customize this URL by specifying the destination path to be redirected to after the user has logged in. You can do this by adding the `destination_path` query parameter to the end of the URL. For example
Expand Down
1 change: 0 additions & 1 deletion lib/passwordless.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def self.digest(token)
mattr_accessor(:token_generator) { UrlSafeBase64Generator.new }
mattr_accessor(:restrict_token_reuse) { false }
mattr_accessor(:redirect_back_after_sign_in) { true }
mattr_accessor(:mounted_as) { :configured_when_mounting_passwordless }

mattr_accessor(:expires_at) { lambda { 1.year.from_now } }
mattr_accessor(:timeout_at) { lambda { 1.hour.from_now } }
Expand Down

0 comments on commit 2f97a19

Please sign in to comment.