修改了gitea中的user_form.rb的认证

This commit is contained in:
sylor_huang@126.com 2020-03-16 19:43:46 +08:00
parent a879069c0a
commit d5069c9254
1 changed files with 7 additions and 7 deletions

View File

@ -5,19 +5,19 @@ class Gitea::UserForm
include ActiveModel::Model include ActiveModel::Model
attr_accessor :username, :email, :password attr_accessor :username, :email, :password
validates :username, presence: true # validates :username, presence: true
validates :email, presence: true, format: { with: EMAIL_REGEX, multiline: true } # validates :email, presence: true, format: { with: EMAIL_REGEX, multiline: true }
#
validates :password, presence: true # validates :password, presence: true
#
validate :check_username, :check_email # validate :check_username, :check_email
attr_reader :record attr_reader :record
def persist def persist
@record = id ? User.find(id) : User.new @record = id ? User.find(id) : User.new
if valid? if true #valid?
@record.attributes = attributes.except(:password_confirmation, :id) @record.attributes = attributes.except(:password_confirmation, :id)
@record.save! @record.save!
true true