From b23fb0a4746d35b0eb1dfd34624ac058030cc9dc Mon Sep 17 00:00:00 2001 From: rt00492 <rt00492@surrey.ac.uk> Date: Sun, 8 May 2022 22:49:10 +0100 Subject: [PATCH] Adding get_ids --- app/controllers/auth_controller.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/controllers/auth_controller.rb b/app/controllers/auth_controller.rb index bd380c5..89accfe 100644 --- a/app/controllers/auth_controller.rb +++ b/app/controllers/auth_controller.rb @@ -26,6 +26,20 @@ class AuthController < ApplicationController render json: { emails: emails }, status: 200 end + def get_ids + emails = params["auth"]["emails"] + ids = [] + if emails.kind_of?(Array) + emails.each do |e| + ids.push(User.find_by(email: e).id) + end + else + ids.push(User.find_by(email: emails).id) + end + render json: { ids: ids }, status: 200 + + end + def password_reset_token token, hashed_token = Devise.token_generator.generate(User, :reset_password_token) user = User.find_by(email: params["email"]) -- GitLab