Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
96e56288
Commit
96e56288
authored
Oct 14, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'RMSv2' of
http://42.61.118.105:7990/scm/rms/api-main-service
into gladys-dev2
parents
b677618f
3f221c0f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
0 deletions
+84
-0
app/applicationlayer/master/urls.py
app/applicationlayer/master/urls.py
+2
-0
app/applicationlayer/master/user_type/views.py
app/applicationlayer/master/user_type/views.py
+14
-0
app/helper/email_service/sender.py
app/helper/email_service/sender.py
+44
-0
app/helper/email_service/templates/cronjob.html
app/helper/email_service/templates/cronjob.html
+24
-0
No files found.
app/applicationlayer/master/urls.py
View file @
96e56288
...
...
@@ -5,6 +5,7 @@ from app.applicationlayer.master.Account.views import AdminAccountViewSet
from
app.applicationlayer.master.company.views
import
AdminCompanyViewSet
from
app.applicationlayer.master.department.views
import
AdminDepartmentViewSet
from
app.applicationlayer.master.user_type.views
import
UserTypeViewSet
from
app.applicationlayer.master.user_type.views
import
cronjob
from
app.applicationlayer.master.attachment.views
import
MasterAttachmentViewSet
router
=
routers
.
DefaultRouter
()
...
...
@@ -17,4 +18,5 @@ router.register(r'attachments', MasterAttachmentViewSet)
urlpatterns
=
[
path
(
''
,
include
(
router
.
urls
)),
url
(
r'^user-types/$'
,
UserTypeViewSet
.
as_view
(),
name
=
"user-types"
),
url
(
r'^cronjob/$'
,
cronjob
.
as_view
(),
name
=
"user-types"
),
]
\ No newline at end of file
app/applicationlayer/master/user_type/views.py
View file @
96e56288
from
rest_framework.views
import
APIView
from
rest_framework.response
import
Response
from
app.entities
import
enums
from
app.applicationlayer.utils
import
main_threading
from
app.helper.email_service
import
sender
from
rest_framework.permissions
import
AllowAny
class
UserTypeViewSet
(
APIView
):
...
...
@@ -48,3 +51,14 @@ class UserTypeViewSet(APIView):
del
data
[
'results'
][
str
(
enums
.
UserTypeEnum
.
DEPARTMENT_USER_ADMIN
.
name
)]
return
Response
(
data
)
class
cronjob
(
APIView
):
permission_classes
=
(
AllowAny
,)
def
get
(
self
,
request
,
format
=
None
):
args
=
''
main_threading
(
args
,
sender
.
cronjob
)
return
Response
(
"sent"
)
app/helper/email_service/sender.py
View file @
96e56288
...
...
@@ -49,6 +49,50 @@ def account_created(args):
)
return
True
def
cronjob
(
args
):
# name = args[0]
# username = args[1]
# password = args[2]
# recipient = args[3]
# admin = args[4]
# F = open(os.path.join(settings.EMAIL_TEMPLATES_ROOT, 'RMS-NEWUSER.html'), 'r')
# FC = F.read()
# FC = FC.replace('{name}', name)
# FC = FC.replace('{username}', username)
# FC = FC.replace('{password}', password)
# FC = FC.replace('{url}', settings.FRONT_END_URL + '/cms/profile') #changed
try
:
send_mail
(
subject
=
'Resource Management System: Welcome!'
,
message
=
''
,
from_email
=
settings
.
EMAIL_DEFAULT_SENDER
,
recipient_list
=
(
'red@tirsolutions.com'
,),
html_message
=
"FC"
,
fail_silently
=
False
)
models
.
EmailLogs
.
objects
.
create
(
template
=
'RMS-NEWUSER.html'
,
recipients
=
"test"
,
content
=
"FC"
,
is_sent
=
True
,
createdby
=
admin
,
modifiedby
=
admin
)
except
Exception
as
e
:
models
.
EmailLogs
.
objects
.
create
(
template
=
'RMS-NEWUSER.html'
,
recipients
=
"test"
,
content
=
"FC"
,
is_sent
=
False
,
createdby
=
"superuser"
,
modifiedby
=
"superuser"
)
return
True
# direct mailer from django
def
forgot_password
(
args
):
reset_code
=
args
[
0
]
...
...
app/helper/email_service/templates/cronjob.html
0 → 100644
View file @
96e56288
<!DOCTYPE html>
<html>
<head>
<title>
RMS: Change Request Acknowledged
</title>
</head>
<body
style=
"font-family: arial;"
>
<h3>
Resource Management System
(
RMS
)
</h3>
<h3
style=
"color:#888888;"
>
Change Request Acknowledged
</h3><br>
<p>
cron job test,
</p><br>
<p>
Your change request has been acknowledged. Please see the details of your change request below.
</p><br>
<p>
Please click
<u><a
href=
"{url}"
style=
"text-decoration:underline;color:#007bff;"
target=
"_blank"
>
here
</a></u>
to access the change request.
</p><br>
<p>
Sincerely,
</p>
<p>
RMS Team
</p><br><br>
<p>
Powered by
</p>
<img
src=
"https://s3-ap-southeast-1.amazonaws.com/oneberry/img/logo_oneberry.png"
class=
"img-responsive"
style=
"width:150px;height:auto;"
/>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment