Class: ReviseAuth::SessionsController

Inherits:
ReviseAuthController show all
Defined in:
app/controllers/revise_auth/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from ReviseAuthController

#revise_auth_controller?

Methods included from Authentication

#authenticate_user, #authenticate_user!, #authenticated_user_from_session, #current_user, #login, #logout, #reset_session, #user_signed_in?

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/revise_auth/sessions_controller.rb', line 5

def create
  if (user = User.authenticate_by(email: params[:email], password: params[:password]))
    (user)
    current_user.api_tokens.first_or_create(name: ApiToken::APP_NAME)
    redirect_to root_path
  else
    # flash[:alert] = I18n.t("revise_auth.invalid_email_or_password")
    render :new, status: :unprocessable_entity
  end
end

#deleteObject



16
17
18
19
# File 'app/controllers/revise_auth/sessions_controller.rb', line 16

def delete
  logout
  redirect_back(fallback_location: root_path)
end

#newObject



2
3
# File 'app/controllers/revise_auth/sessions_controller.rb', line 2

def new
end