Sha256: 57a6c1ba524c186241406ceee63e52bb7810c026a67118fa275156220a293633
Contents?: true
Size: 552 Bytes
Versions: 5
Compression:
Stored size: 552 Bytes
Contents
class SessionsController < ApplicationController skip_before_action :authenticate, except: :destroy def create @<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email]) if @<%= singular_table_name %>.try(:authenticate, params[:password]) render json: { session_token: @<%= singular_table_name %>.signed_session_token } else render json: { error: "Invalid email or password" }, status: :unauthorized end end def destroy Current.<%= singular_table_name %>.regenerate_session_token end end
Version data entries
5 entries across 5 versions & 1 rubygems