Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginApiController < ApplicationController
- def auth
- user = User.find_by(username: params[:username])
- if user && user.authenticate(params[:password])
- render json: user
- else
- render json: { errors: ["wrong username or password"] }, status: :unauthorized
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement