Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add email templates for email token #907

Merged
merged 4 commits into from Feb 6, 2018
Merged

Conversation

cornelinux
Copy link
Member

@cornelinux cornelinux commented Jan 21, 2018

Closes #684

Merging #907 into master will increase coverage by 0.01%.
The diff coverage is 88.88%.
Impacted file tree graph

@@            Coverage Diff            @@
##           master    #907      +/-   ##
=========================================
+ Coverage   95.38%   95.4%   +0.01%
=========================================
Files         129     129
Lines       15913   15920       +7
=========================================
+ Hits        15179   15188       +9
+ Misses        734     732       -2
Impacted Files Coverage Δ
privacyidea/lib/tokens/emailtoken.py 99.37% <88.88%> (+0.02%) ⬆️
privacyidea/lib/tokens/u2f.py 95.79% <0%> (+1.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32f6906...3e8fe58. Read the comment docs.

  

@codecov-io
Copy link

codecov-io commented Jan 21, 2018

Codecov Report

Merging #907 into master will increase coverage by 0.37%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #907      +/-   ##
==========================================
+ Coverage   95.38%   95.76%   +0.37%     
==========================================
  Files         129      129              
  Lines       15913    17344    +1431     
==========================================
+ Hits        15179    16609    +1430     
- Misses        734      735       +1
Impacted Files Coverage Δ
privacyidea/lib/tokens/emailtoken.py 100% <100%> (+0.65%) ⬆️
privacyidea/lib/tokens/yubicotoken.py 94.78% <0%> (-1.06%) ⬇️
privacyidea/lib/tokens/hotptoken.py 100% <0%> (ø) ⬆️
privacyidea/lib/tokenclass.py 99.13% <0%> (+0.19%) ⬆️
privacyidea/lib/tokens/yubikeytoken.py 97.9% <0%> (+0.36%) ⬆️
privacyidea/lib/tokens/radiustoken.py 98.75% <0%> (+0.52%) ⬆️
privacyidea/api/token.py 99.28% <0%> (+1.14%) ⬆️
privacyidea/lib/tokens/remotetoken.py 97.74% <0%> (+1.21%) ⬆️
privacyidea/lib/token.py 96.19% <0%> (+1.66%) ⬆️
privacyidea/lib/tokens/u2f.py 95.79% <0%> (+1.68%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32f6906...a638caa. Read the comment docs.

Also test sending email challenge with new
email scheme with email.identifier.
try:
f = open(message[5:], "r")
message = f.read()
f.close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: I think it would be cooler to use Python with (like we already do in some other places):

with open(message[5:], "r") as f:
    message = f.read()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right

#: lib/tokens/vascotoken.py:100
msgid "VASCO Token: Authentication using VASCO tokens"
msgstr ""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I forgot this in my PR :-(

message = f.read()
f.close()
except Exception as e: # pragma: no cover
log.warning(u"Failed to read email template: {0!r}".format(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the file could not be opened, the email message will be the action value of the policy, e.g. file:/etc/privacyidea/email-template.txt -- we could instead revert to a default value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right.

@fredreichbier fredreichbier merged commit f2a415c into master Feb 6, 2018
@fredreichbier fredreichbier deleted the 684/email-template branch February 6, 2018 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants