mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-26 15:37:24 +00:00
Merge pull request #1830 from thecashewtrader/register-no-email-note
Add a note if user attempts to register with (apparently) an email
This commit is contained in:
commit
30d80e417b
@ -33,6 +33,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { isEmail } from "../utils/Misc.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -52,6 +54,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
register() {
|
register() {
|
||||||
if (!this.username || !this.password) return;
|
if (!this.username || !this.password) return;
|
||||||
|
if (isEmail(this.username) && !confirm(this.$t("info.register_no_email_note"))) return;
|
||||||
|
|
||||||
this.fetchJson(this.authApiUrl() + "/register", null, {
|
this.fetchJson(this.authApiUrl() + "/register", null, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
@ -173,6 +173,7 @@
|
|||||||
"page_not_found": "Page not found",
|
"page_not_found": "Page not found",
|
||||||
"copied": "Copied!",
|
"copied": "Copied!",
|
||||||
"cannot_copy": "Can't copy!",
|
"cannot_copy": "Can't copy!",
|
||||||
"local_storage": "This action requires localStorage, are cookies enabled?"
|
"local_storage": "This action requires localStorage, are cookies enabled?",
|
||||||
|
"register_no_email_note": "Using an e-mail as username is not recommended. Proceed anyways?"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
src/utils/Misc.js
Normal file
8
src/utils/Misc.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export const isEmail = input => {
|
||||||
|
// Taken from https://emailregex.com
|
||||||
|
const result = input.match(
|
||||||
|
//eslint-disable-next-line
|
||||||
|
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user