From 6ce4b2604714d5d97dc75ba023966c942b8b1d28 Mon Sep 17 00:00:00 2001 From: jasder Date: Fri, 2 Apr 2021 18:40:26 +0800 Subject: [PATCH] FIX api bug --- app/controllers/users_controller.rb | 2 +- app/forms/users/update_info_form.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ca0988ea0..91258678e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -234,7 +234,7 @@ class UsersController < ApplicationController end def sync_user_info - user = User.find_by_mail params[:email] + user = User.find_by_login params[:login] return render_forbidden unless user === current_user sync_params = { diff --git a/app/forms/users/update_info_form.rb b/app/forms/users/update_info_form.rb index 131a6fd93..088db06d3 100644 --- a/app/forms/users/update_info_form.rb +++ b/app/forms/users/update_info_form.rb @@ -1,8 +1,9 @@ class Users::UpdateInfoForm include ActiveModel::Model - attr_accessor :email, :password + attr_accessor :email, :password, :login validates :email, presence: true, format: { with: CustomRegexp::EMAIL } validates :password, presence: true + validates :login, presence: true end