SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class AuthController < ApplicationController
  2.   include ::ActionController::Cookies
  3.  
  4.   def login
  5.     if params['data']['login'] && params['data']['password']
  6.       user = User.find_by(login: params['data']['login'])
  7.       if user && user.authenticate(params['data']['password'])
  8.         session[:user_id] = user.id
  9.       else
  10.         render json: {message: 'Wrong login or password'}, status: 403
  11.       end
  12.     else
  13.       render json: {}, status: 401
  14.     end
  15.   end
  16. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top