mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 16:31:43 +00:00
loguear mejor los login
This commit is contained in:
parent
55f5797a54
commit
5f27e09eda
1 changed files with 9 additions and 2 deletions
|
@ -12,7 +12,11 @@ module Warden
|
||||||
return false unless params.include? 'username'
|
return false unless params.include? 'username'
|
||||||
return false unless params.include? 'password'
|
return false unless params.include? 'password'
|
||||||
|
|
||||||
@email = EmailAddress.new(params['username'])
|
username = params['username']
|
||||||
|
|
||||||
|
@email = EmailAddress.new(username, host_validation: :a)
|
||||||
|
|
||||||
|
Rails.logger.error [username, @email.error].join(': ') unless @email.valid?
|
||||||
|
|
||||||
@email.valid?
|
@email.valid?
|
||||||
end
|
end
|
||||||
|
@ -32,17 +36,20 @@ module Warden
|
||||||
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::ENETUNREACH,
|
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::ENETUNREACH,
|
||||||
SocketError, Net::IMAP::ByeResponseError => e
|
SocketError, Net::IMAP::ByeResponseError => e
|
||||||
|
|
||||||
|
Rails.logger.error e.to_s
|
||||||
@imap.disconnect
|
@imap.disconnect
|
||||||
fail! e.to_s
|
fail! e.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def imap_login
|
def imap_login
|
||||||
|
Rails.logger.info "Autenticando a #{@email.normal}"
|
||||||
@imap.login(@email.normal, params['password'])
|
@imap.login(@email.normal, params['password'])
|
||||||
@imap.disconnect
|
@imap.disconnect
|
||||||
|
|
||||||
success! Usuaria.find(@email.normal)
|
success! Usuaria.find(@email.normal)
|
||||||
rescue EOFError => e
|
rescue Net::IMAP::NoResponseError, EOFError => e
|
||||||
@imap.disconnect
|
@imap.disconnect
|
||||||
|
Rails.logger.error e.to_s
|
||||||
fail! e.to_s
|
fail! e.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue