新增: 根据邮箱来获取用户
This commit is contained in:
parent
5cf257c3cc
commit
8e8ec821f2
|
@ -3,7 +3,7 @@ module RenderHelper
|
|||
render json: { status: 0, message: 'success' }.merge(data)
|
||||
end
|
||||
|
||||
def render_error(status = -1, message = '')
|
||||
def render_error(message = '', status=-1)
|
||||
render json: { status: status, message: message }
|
||||
end
|
||||
|
||||
|
|
|
@ -301,6 +301,12 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def email_search
|
||||
return render_error('请输入email') if params[:email].blank?
|
||||
@user = User.find_by(mail: params[:email])
|
||||
return render_not_found unless @user.present?
|
||||
end
|
||||
|
||||
private
|
||||
def load_user
|
||||
@user = User.find_by_login(params[:id]) || User.find_by(id: params[:id])
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
json.partial! 'users/user', locals: { user: @user }
|
|
@ -237,6 +237,7 @@ Rails.application.routes.draw do
|
|||
get :trustie_projects
|
||||
get :trustie_related_projects
|
||||
post :sync_user_info
|
||||
get :email_search
|
||||
|
||||
scope '/ci', module: :ci do
|
||||
scope do
|
||||
|
|
Loading…
Reference in New Issue