-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
JSON::Serializable
from models
Ensures we are not sending sensitive data (eg: password digests) to redis.
- Loading branch information
Showing
8 changed files
with
145 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
class LoginNotificationEmail < BaseEmail | ||
def initialize(operation : StartCurrentLogin, @login : Login) | ||
@login : { | ||
active_at: Time, | ||
ip_address: String, | ||
user: { | ||
email: String, | ||
first_name: String, | ||
full_name: String, | ||
last_name: String | ||
} | ||
} | ||
|
||
def initialize(operation : StartCurrentLogin, login : Login) | ||
user = login.user | ||
|
||
@login = { | ||
active_at: login.active_at, | ||
ip_address: login.ip_address, | ||
user: { | ||
email: user.email, | ||
first_name: user.first_name, | ||
full_name: user.full_name, | ||
last_name: user.last_name | ||
} | ||
} | ||
end | ||
|
||
reply_to App.settings.email_reply_to | ||
|
||
private def receiver | ||
@login.user | ||
Carbon::Address.new(@login[:user][:full_name], @login[:user][:email]) | ||
end | ||
|
||
private def heading | ||
Rex.t(:"email.login_notification.subject", app_name: App.settings.name) | ||
end | ||
|
||
private def text_message : String | ||
user = @login.user | ||
|
||
Rex.t( | ||
:"email.login_notification.body", | ||
app_name: App.settings.name, | ||
first_name: user.first_name, | ||
last_name: user.last_name, | ||
full_name: user.full_name, | ||
login_time: Rex.l(@login.active_at, :long), | ||
ip_address: @login.ip_address | ||
first_name: @login[:user][:first_name], | ||
last_name: @login[:user][:last_name], | ||
full_name: @login[:user][:full_name], | ||
login_time: Rex.l(@login[:active_at], :long), | ||
ip_address: @login[:ip_address] | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters