Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/splits-io. a speedrunning data store and analysis engine splits.io
Something went wrong. Try again.
123456789101112131415161718192021222324252627class SessionsController < ApplicationController def create user = User.where(twitch_id: request.env['omniauth.auth'].uid).first_or_create( name: request.env['omniauth.auth'].info.name, email: request.env['omniauth.auth'].info.email, avatar: request.env['omniauth.auth'].info.logo ) if user.errors.present? redirect_to cookies.delete(:return_to) || root_path, alert: "Error: #{user.errors.full_messages.join(', ')}." return end
self.current_user = user auth_session.persist! redirect_to cookies.delete(:return_to) || root_path, notice: "Signed in as #{current_user.name}. o/" end
def destroy auth_session.invalidate! redirect_to :back, notice: 'Signed out. (>-.-)>' end
def failure redirect_to cookies.delete(:return_to) || root_path, alert: params[:message] endend