aiueo49 / oasobi

0 stars 0 forks source link

新規会員登録後、自動でログインした状態にする #22

Closed aiueo49 closed 6 months ago

aiueo49 commented 6 months ago

sorceryのメソッドでオートログインがあるらしいのでそれを使う

aiueo49 commented 6 months ago
require_login # This is a before action
login(email, password, remember_me = false)
auto_login(user) # Login without credentials
logout
logged_in? # Available in views
current_user # Available in views
redirect_back_or_to # Use when a user tries to access a page while logged out, is asked to login, and we want to return him back to the page he originally wanted
@user.external? # Users who signed up using Facebook, Twitter, etc.
@user.active_for_authentication? # Add this method to define behaviour that will prevent selected users from signing in
@user.valid_password?('secret') # Compares 'secret' with the actual user's password, returns true if they match
User.authenticates_with_sorcery!