add smtp port on front
This commit is contained in:
parent
af4cc2f6a0
commit
e8e8555c2f
@ -11,35 +11,49 @@ const email = ref("");
|
|||||||
const pwd = ref("");
|
const pwd = ref("");
|
||||||
const xoauth = ref("");
|
const xoauth = ref("");
|
||||||
const xoauth2 = ref("");
|
const xoauth2 = ref("");
|
||||||
const host = ref("");
|
const imapHost = ref("");
|
||||||
const port = ref(993);
|
const imapPort = ref(993);
|
||||||
|
const smtpHost = ref("");
|
||||||
|
const smtpPort = ref(465);
|
||||||
|
|
||||||
const error = ref("");
|
const error = ref("");
|
||||||
|
|
||||||
const knownHosts = {
|
const knownHosts = {
|
||||||
"outlook.com": {
|
"outlook.com": {
|
||||||
host: "outlook.office365.com",
|
imap: "outlook.office365.com",
|
||||||
|
smtp: "outlook.office365.com",
|
||||||
},
|
},
|
||||||
"hotmail.com": {
|
"hotmail.com": {
|
||||||
host: "outlook.office365.com",
|
imap: "outlook.office365.com",
|
||||||
|
smtp: "outlook.office365.com",
|
||||||
},
|
},
|
||||||
"live.com": {
|
"live.com": {
|
||||||
host: "outlook.office365.com",
|
imap: "outlook.office365.com",
|
||||||
|
smtp: "outlook.office365.com",
|
||||||
},
|
},
|
||||||
"zoho.com": {
|
"zoho.com": {
|
||||||
host: "imap.zoho.eu",
|
imap: "imap.zoho.eu",
|
||||||
|
smtp: "smtp.zoho.eu",
|
||||||
},
|
},
|
||||||
"yahoo.com": {
|
"yahoo.com": {
|
||||||
host: "imap.mail.yahoo.com",
|
imap: "imap.mail.yahoo.com",
|
||||||
|
smtp: "smtp.mail.yahoo.com",
|
||||||
},
|
},
|
||||||
"icloud.com": {
|
"icloud.com": {
|
||||||
host: "imap.mail.me.com",
|
imap: "imap.mail.me.com",
|
||||||
|
smtp: "smtp.mail.me.com",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const refHost = computed({
|
const refSmtpHost = computed({
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
host.value = val;
|
smtpHost.value = val;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const refImapHost = computed({
|
||||||
|
set: (val) => {
|
||||||
|
imapHost.value = val;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -62,7 +76,7 @@ function checkError() {
|
|||||||
err.value = "You need at least one authentification method.";
|
err.value = "You need at least one authentification method.";
|
||||||
} else if ([pwd.value, xoauth.value, xoauth2.value].filter((val) => val != "").length > 1) {
|
} else if ([pwd.value, xoauth.value, xoauth2.value].filter((val) => val != "").length > 1) {
|
||||||
err.value = "You need only one authentification method.";
|
err.value = "You need only one authentification method.";
|
||||||
} else if (host.value == "" || port.value == "") {
|
} else if (smtpHost.value == "" || smtpPort.value == "" || imapHost.value == "" || imapPort.value == "") {
|
||||||
err.value = "You need to complete the port and the host.";
|
err.value = "You need to complete the port and the host.";
|
||||||
} else {
|
} else {
|
||||||
err.value = "";
|
err.value = "";
|
||||||
@ -77,8 +91,10 @@ function addAccountRequest() {
|
|||||||
pwd: pwd.value,
|
pwd: pwd.value,
|
||||||
xoauth: xoauth.value,
|
xoauth: xoauth.value,
|
||||||
xoauth2: xoauth2.value,
|
xoauth2: xoauth2.value,
|
||||||
host: host.value,
|
imapHost: imapHost.value,
|
||||||
port: port.value,
|
imapPort: imapPort.value,
|
||||||
|
smtpHost: smtpHost.value,
|
||||||
|
smtpPort: smtpPort.value,
|
||||||
tls: true,
|
tls: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -98,15 +114,14 @@ watchEffect(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function mailChange() {
|
function mailChange() {
|
||||||
console.log(email.value);
|
|
||||||
if (email.value.includes("@")) {
|
if (email.value.includes("@")) {
|
||||||
const domain = email.value.split("@")[1];
|
const domain = email.value.split("@")[1];
|
||||||
if (!knownHosts[domain]) {
|
if (imapHost.value == "") {
|
||||||
refHost.value = "imap." + domain;
|
refImapHost.value = knownHosts[domain]?.imap ?? `imap.${domain}`;
|
||||||
} else {
|
}
|
||||||
refHost.value = knownHosts[domain].host;
|
if (smtpHost.value == "") {
|
||||||
|
refSmtpHost.value = knownHosts[domain]?.smtp ?? `smtp.${domain}`;
|
||||||
}
|
}
|
||||||
// todo check if manual
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -117,10 +132,17 @@ function mailChange() {
|
|||||||
<Modal v-if="modal" title="Add new account" @close-modal="modal = false">
|
<Modal v-if="modal" title="Add new account" @close-modal="modal = false">
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Input label="Email:" :onChange="mailChange" v-model="email" type="email" required />
|
<Input
|
||||||
|
label="Email:"
|
||||||
|
:onChange="mailChange"
|
||||||
|
v-model="email"
|
||||||
|
type="email"
|
||||||
|
placeholder="email"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset>
|
<!-- <fieldset>
|
||||||
<legend>Authentification method</legend>
|
<legend>Authentification method</legend>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Input label="Plain password:" v-model="pwd" type="password" />
|
<Input label="Plain password:" v-model="pwd" type="password" />
|
||||||
@ -131,12 +153,19 @@ function mailChange() {
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<Input label="Xoauth2:" v-model="xoauth2" type="text" />
|
<Input label="Xoauth2:" v-model="xoauth2" type="text" />
|
||||||
</div>
|
</div>
|
||||||
|
</fieldset> -->
|
||||||
|
|
||||||
|
<fieldset class="config">
|
||||||
|
<legend>Imap</legend>
|
||||||
|
<Input v-model="imapHost" class="host" type="text" placeholder="host" />
|
||||||
|
<Input v-model="imapPort" class="port" type="number" placeholder="port" />
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="config">
|
||||||
|
<legend>Smtp</legend>
|
||||||
|
<Input v-model="smtpHost" class="host" type="text" placeholder="host" />
|
||||||
|
<Input v-model="smtpPort" class="port" type="number" placeholder="port" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="config">
|
|
||||||
<Input v-model="host" id="host" type="text" placeholder="imap host" />
|
|
||||||
<Input v-model="port" id="port" type="number" placeholder="port" />
|
|
||||||
</div>
|
|
||||||
<!-- tls -->
|
<!-- tls -->
|
||||||
<div>
|
<div>
|
||||||
<Button :disabled="error != ''" :onClick="addAccountRequest" text="Add" />
|
<Button :disabled="error != ''" :onClick="addAccountRequest" text="Add" />
|
||||||
@ -168,15 +197,16 @@ fieldset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.config {
|
.config {
|
||||||
|
display: block;
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#host {
|
.host {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
width: calc(95% - 100px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#port {
|
.port {
|
||||||
|
display: inline-flex;
|
||||||
width: 70px;
|
width: 70px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user