Commit c4647646 by liyijie

Fix register_valid logic

parent 5b28af12
...@@ -123,7 +123,7 @@ module RailsApiAuthentication ...@@ -123,7 +123,7 @@ module RailsApiAuthentication
def register(name, password, attrs={}) def register(name, password, attrs={})
raise(UserError.new(400, '-1', 'password is blank')) if password.blank? raise(UserError.new(400, '-1', 'password is blank')) if password.blank?
valid! name, attrs.delete(@valid_key) unless @register_valid valid! name, attrs.delete(@valid_key) if @register_valid
user = self.create!({auth_key => name, @auth_password => generate_password(password)}) user = self.create!({auth_key => name, @auth_password => generate_password(password)})
user.token = AuthToken.create(self, oauth_params(attrs).merge({ oid: user.id }) ).token user.token = AuthToken.create(self, oauth_params(attrs).merge({ oid: user.id }) ).token
user user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment