Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
2b5130e4
Commit
2b5130e4
authored
3 years ago
by
Stein Elgethun
Browse files
Options
Downloads
Patches
Plain Diff
Add button for sending testmail in frontend
Issue: GREG-66
parent
61c2a8b6
No related branches found
No related tags found
1 merge request
!98
Greg 66 mail queue
Pipeline
#96148
passed
3 years ago
Stage: venv update
Stage: tests and linting
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/src/components/debug/index.tsx
+16
-0
16 additions, 0 deletions
frontend/src/components/debug/index.tsx
gregui/urls.py
+1
-0
1 addition, 0 deletions
gregui/urls.py
gregui/views.py
+6
-0
6 additions, 0 deletions
gregui/views.py
with
23 additions
and
0 deletions
frontend/src/components/debug/index.tsx
+
16
−
0
View file @
2b5130e4
...
...
@@ -82,6 +82,19 @@ export const Debug = () => {
})
}
const
testMail
=
()
=>
{
fetch
(
'
/api/ui/v1/testmail/
'
,
{
credentials
:
'
same-origin
'
,
})
.
then
((
data
)
=>
{
console
.
log
(
data
)
})
.
catch
((
err
)
=>
{
console
.
log
(
err
)
})
}
const
whoami
=
()
=>
{
fetch
(
'
/api/ui/v1/whoami/
'
,
{
headers
:
{
...
...
@@ -151,6 +164,9 @@ export const Debug = () => {
<
Button
type
=
"button"
onClick
=
{
()
=>
logout
()
}
>
LOGOUT
</
Button
>
<
Button
type
=
"button"
onClick
=
{
()
=>
testMail
()
}
>
SEND TEST MAIL
</
Button
>
</
Stack
>
<
Box
sx
=
{
{
maxWidth
:
'
30rem
'
}
}
>
<
Table
>
...
...
This diff is collapsed.
Click to expand it.
gregui/urls.py
+
1
−
0
View file @
2b5130e4
...
...
@@ -17,6 +17,7 @@ urlpatterns: List[URLResolver] = [
path
(
"
api/ui/v1/logout/
"
,
views
.
logout_view
,
name
=
"
api-logout
"
),
path
(
"
api/ui/v1/login/
"
,
views
.
login_view
,
name
=
"
api-login
"
),
path
(
"
api/ui/v1/session/
"
,
views
.
SessionView
.
as_view
(),
name
=
"
api-session
"
),
path
(
"
api/ui/v1/testmail/
"
,
views
.
send_test_email
,
name
=
"
api-testmail
"
),
path
(
"
api/ui/v1/whoami/
"
,
views
.
WhoAmIView
.
as_view
(),
name
=
"
api-whoami
"
),
path
(
"
api/ui/v1/userinfo/
"
,
UserInfoView
.
as_view
()),
# type: ignore
path
(
"
api/ui/v1/ous/
"
,
OusView
.
as_view
()),
...
...
This diff is collapsed.
Click to expand it.
gregui/views.py
+
6
−
0
View file @
2b5130e4
...
...
@@ -8,6 +8,7 @@ from rest_framework.views import APIView
from
greg.models
import
Role
,
Sponsor
from
greg.permissions
import
IsSponsor
from
gregui
import
mailutils
from
gregui.models
import
GregUserProfile
...
...
@@ -37,6 +38,11 @@ def login_view(request):
return
redirect
(
"
/api/ui/v1/whoami/
"
)
def
send_test_email
(
request
):
mailutils
.
send_registration_mail
(
"
test@example.no
"
,
"
Foo Bar
"
)
return
JsonResponse
({
"
detail
"
:
"
Created task to send test mail.
"
})
class
SessionView
(
APIView
):
authentication_classes
=
[
SessionAuthentication
,
BasicAuthentication
]
permission_classes
=
[
IsAuthenticated
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment