44-->
55
66<script setup lang="ts">
7- import type { Certificate } from ' electron '
7+ import type { UntrustedCertificateDetails } from ' ../../app/certificate.service.ts '
88
99import { t } from ' @nextcloud/l10n'
1010import { useHotKey } from ' @nextcloud/vue/composables/useHotKey'
11+ import { ref } from ' vue'
1112import NcButton from ' @nextcloud/vue/components/NcButton'
1213import NcNoteCard from ' @nextcloud/vue/components/NcNoteCard'
14+ import IconAlert from ' vue-material-design-icons/Alert.vue'
15+ import IconShieldOffOutline from ' vue-material-design-icons/ShieldOffOutline.vue'
1316import CertificateInfo from ' ./components/CertificateInfo.vue'
1417
1518useHotKey (' Escape' , () => window .close ())
1619
17- const certificate = JSON .parse (decodeURIComponent (location .hash .slice (1 ))) as Certificate
20+ const { host, certificate, error } = JSON .parse (decodeURIComponent (location .hash .slice (1 ))) as UntrustedCertificateDetails
21+ const urlParam = {
22+ value: ` <strong>${host }</strong> ` ,
23+ escape: false ,
24+ }
1825
1926const acceptCertificate = window .TALK_DESKTOP .acceptCertificate
27+
28+ const isAdvanced = ref (false )
2029 </script >
2130
2231<template >
2332 <div class =" certificate" >
2433 <h2 class =" certificate__heading" >
25- {{ t('talk_desktop', 'Untrusted certificate') }}
34+ <IconAlert :size =" 30" class =" certificate__alert-icon" />
35+ {{ t('talk_desktop', 'Warning: potential security risk') }}
2636 </h2 >
2737
28- <div class =" certificate__content" >
29- <NcNoteCard type =" warning" class =" certificate__note" >
30- {{ t('talk_desktop', 'The server\'s security certificate is not trusted. Your connection may not be secure. Proceed only if you trust this certificate.') }}
31- </NcNoteCard >
38+ <NcNoteCard type =" error" class =" certificate__note" >
39+ <template #icon >
40+ <IconShieldOffOutline :size =" 24" class =" certificate__alert-icon" />
41+ </template >
42+ <!-- eslint-disable-next-line -->
43+ <p v-html =" t('talk_desktop', 'Connection to {url} is not private.', { url: urlParam })" />
44+ <p >{{ t('talk-desktop', 'If you are unsure to proceed contact your system administrator.') }}</p >
45+ </NcNoteCard >
46+
47+ <NcButton
48+ v-if =" !isAdvanced"
49+ aria-expanded =" false"
50+ variant =" error"
51+ @click =" isAdvanced = true" >
52+ {{ t('talk_desktop', 'Advanced') }}
53+ </NcButton >
3254
33- <CertificateInfo :certificate =" certificate" />
55+ <div class =" certificate__content" >
56+ <div v-if =" isAdvanced" class =" certificate__advanced" >
57+ <!-- eslint-disable-next-line -->
58+ <p v-html =" t('talk_desktop', 'This server could not prove that it is {url}.', { url: urlParam })" />
59+ <p >
60+ {{ t('talk_desktop', 'It has untrusted SSL certificate. This might be caused by an attacker intercepting your connection or server misconfiguration.') }}
61+ </p >
62+ <p >
63+ <code >{{ error }}</code >
64+ </p >
65+ <p >
66+ <NcButton variant =" error" @click =" acceptCertificate(true)" >
67+ {{ t('talk_desktop', 'Proceed') }}
68+ </NcButton >
69+ </p >
70+ <details >
71+ <summary >
72+ {{ t('talk_desktop', 'View certificate') }}
73+ </summary >
74+ <CertificateInfo :certificate =" certificate" />
75+ </details >
76+ </div >
3477 </div >
3578
3679 <div class =" certificate__actions" >
37- <NcButton variant =" secondary" wide @click =" acceptCertificate(false)" >
38- {{ t('talk_desktop', 'Reject') }}
39- </NcButton >
40- <NcButton variant =" primary" wide @click =" acceptCertificate(true)" >
41- {{ t('talk_desktop', 'Accept') }}
80+ <NcButton variant =" primary" wide @click =" acceptCertificate(false)" >
81+ {{ t('talk_desktop', 'Cancel') }}
4282 </NcButton >
4383 </div >
4484 </div >
@@ -63,11 +103,18 @@ const acceptCertificate = window.TALK_DESKTOP.acceptCertificate
63103
64104.certificate__heading {
65105 margin-block : 0 ;
106+ display : flex ;
107+ align-items : baseline ;
108+ justify-content : center ;
109+ gap : 1ch ;
66110 font-size : 1.5em ;
67- text-align : center ;
68111 text-transform : capitalize ;
69112}
70113
114+ .certificate__alert-icon {
115+ color : var (--color-error );
116+ }
117+
71118.certificate__content {
72119 flex : 1 ;
73120 margin-inline : calc (-4 * var (--default-grid-baseline ));
@@ -78,14 +125,24 @@ const acceptCertificate = window.TALK_DESKTOP.acceptCertificate
78125 overflow : auto ;
79126}
80127
128+ .certificate__advanced {
129+ border : 1px solid var (--color-border );
130+ border-radius : var (--border-radius-small );
131+ padding : calc (2 * var (--default-grid-baseline ));
132+ display : flex ;
133+ flex-direction : column ;
134+ gap : 1em ;
135+ background-color : var (--color-background-dark );
136+ }
137+
81138.certificate__note {
82139 /* Override default component styles */
83140 margin : 0 ;
84- margin-block-end : calc (3 * var (--default-grid-baseline ));
85141}
86142
87143.certificate__actions {
88144 display : flex ;
89145 gap : calc (2 * var (--default-grid-baseline ));
146+ align-items : flex-end ;
90147}
91148 </style >
0 commit comments