diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a78428f..c0ccdf4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,7 @@ class UsersController < ApplicationController before_action :authenticate, except: [ :emailExist, :usernameExist, :create ] + skip_before_action :verify_authenticity_token, :only => [:emailExist,:usernameExist,:create,:update] def emailExist if checkExist?(:email, params[:email]) @@ -42,6 +43,6 @@ class UsersController < ApplicationController end def user_params - params.require(:user).permit(:name, :password, :password_confirmation, :email, :phone) + params.require(:user).permit(:name,:password, :password_confirmation, :email, :phone) end end diff --git a/app/models/user.rb b/app/models/user.rb index da707d3..7dbe1c5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -9,7 +9,7 @@ class User < ActiveRecord::Base validates :name, presence: true, uniqueness: true, length: { maximum: 30 } validates :email, presence: true, uniqueness: true, length: { maximum: 50}, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i } - validates :password, length: { minimum: 6 } + validates :password, length: { minimum: 6 },on:create validates :phone, presence: true, uniqueness: true, format: { with: /\A[0-9]{11,11}\Z/i }, multiline: false end diff --git a/app/views/sessions/show.json.jbuilder b/app/views/sessions/show.json.jbuilder index daacbcb..fa512e4 100644 --- a/app/views/sessions/show.json.jbuilder +++ b/app/views/sessions/show.json.jbuilder @@ -1 +1 @@ -json.extract! current_user, :id, :name, :email, :created_at \ No newline at end of file +json.extract! current_user, :id, :name, :email, :created_at,:phone \ No newline at end of file diff --git a/public/pages/alter_info.html b/public/pages/alter_info.html index bef4e75..68d6572 100644 --- a/public/pages/alter_info.html +++ b/public/pages/alter_info.html @@ -62,21 +62,21 @@
- +
- +
- +
@@ -84,7 +84,7 @@ @@ -104,14 +104,14 @@
- +
- +
@@ -119,7 +119,7 @@ @@ -144,6 +144,89 @@ + \ No newline at end of file