开发者

Rails/Devise changing min length of username

开发者 https://www.devze.com 2023-02-03 11:19 出处:网络
Rails 3.0 Authlogic 2.1.6 Using username (not email) for authentication. Authlogic requi开发者_如何转开发res username to be at least 3 characters.

Rails 3.0 Authlogic 2.1.6

Using username (not email) for authentication.

Authlogic requi开发者_如何转开发res username to be at least 3 characters.

How does one convince Authologic to allow a 2 character username?

Thanks for your help.


You can override the authlogic default username length by adding the following code to models/user.rb

class User < ActiveRecord::Base

  acts_as_authentic do |c|
    c.merge_validates_length_of_login_field_options :within => 4..100
  end

  #....

end

This assumes your user model is called User

0

精彩评论

暂无评论...
验证码 换一张
取 消