forked from jasder/forgeplus
修改了gitea中的user_form.rb的认证
This commit is contained in:
parent
a879069c0a
commit
d5069c9254
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue