|
1class UsersController < ApplicationController
|
|
|
|
3 before_action :authenticate, except: [ :emailExist, :usernameExist, :create ]
|
|
4 skip_before_action :verify_authenticity_token, :only => [
|
|
|
|
|
|
|
|
|
|
|
|
|
- Complexity 2 » saikuro
- Method name "emailExist" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ » roodi
- UncommunicativeMethodName - has the name 'emailExist' » reek
|
|
|
12 if checkExist?(:email, params[:email])
|
|
|
|
|
|
|
|
|
|
|
|
|
- Complexity 2 » saikuro
- Method name "usernameExist" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ » roodi
- UncommunicativeMethodName - has the name 'usernameExist' » reek
|
|
|
20 if checkExist?(:name, params[:username])
|
|
21 render :text => 'exist'
|
|
|
|
23 render :text => 'not exist'
|
|
|
|
|
|
|
|
|
|
28 @user = User.new(user_params)
|
|
|
|
30 render status: :created, nothing: true
|
|
|
|
32 render json: @user.errors, status: :unprocessable_entity
|
|
|
|
|
|
|
|
|
|
|
|
38 if @user.update(user_params)
|
|
|
|
|
|
41 render json:current_user.errors, status: :unprocessable_entity
|
|
|
|
|
|
|
|
|
- Complexity 1 » saikuro
- Method name "checkExist?" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ » roodi
- UtilityFunction - doesn't depend on instance state » reek
- UncommunicativeMethodName - has the name 'checkExist?' » reek
|
46 def checkExist?(field_name, value)
|
|
47 User.exists?(field_name => value)
|
|
|
|
|
|
|
|
51 params.require(:user).permit(:name,:password, :password_confirmation, :email, :phone)
|
|
|
|
|