class Vines::Stanza::Iq::Register
Constants
- NS
Public Instance Methods
process()
click to toggle source
# File lib/vines/stanza/iq/register.rb, line 11 def process if is_stream_owner current_user = storage(stream.domain).find_user(stream.user.jid) password = @node.xpath("//iq/jir:query//jir:password", {"jir"=>"jabber:iq:register"}).text unless password.nil? current_user.password = BCrypt::Password.create(password.to_s) storage.save_user(current_user) stream.write(to_result) else raise StanzaErrors::NotAcceptable.new(self, 'cancel') end else end end
Private Instance Methods
is_stream_owner()
click to toggle source
# File lib/vines/stanza/iq/register.rb, line 29 def is_stream_owner stream.user.jid.bare == jid_from_username.bare end
jid_from_username()
click to toggle source
# File lib/vines/stanza/iq/register.rb, line 33 def jid_from_username username = @node.xpath("//iq/jir:query//jir:username", {"jir"=>"jabber:iq:register"}).text dom = @node.attributes["to"].text JID.new(username, dom) end