mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-05-21 17:32:03 +00:00
Hard coded relays in signup to grab profile successfully
This commit is contained in:
parent
a7cac6ef51
commit
3746a9fbaa
@ -1,5 +1,4 @@
|
|||||||
import NextAuth from "next-auth";
|
import NextAuth from "next-auth";
|
||||||
import { track } from '@vercel/analytics/server';
|
|
||||||
import CredentialsProvider from "next-auth/providers/credentials";
|
import CredentialsProvider from "next-auth/providers/credentials";
|
||||||
import EmailProvider from "next-auth/providers/email";
|
import EmailProvider from "next-auth/providers/email";
|
||||||
import NDK from "@nostr-dev-kit/ndk";
|
import NDK from "@nostr-dev-kit/ndk";
|
||||||
@ -14,8 +13,9 @@ import { createRole } from "@/db/models/roleModels";
|
|||||||
import appConfig from "@/config/appConfig";
|
import appConfig from "@/config/appConfig";
|
||||||
|
|
||||||
// todo update EMAIL_FROM to be a plebdevs email
|
// todo update EMAIL_FROM to be a plebdevs email
|
||||||
|
// TODO: remove hardcoded relays from here after testing phase
|
||||||
const ndk = new NDK({
|
const ndk = new NDK({
|
||||||
explicitRelayUrls: appConfig.defaultRelayUrls,
|
explicitRelayUrls: [...appConfig.defaultRelayUrls, "wss://relay.damus.io/", "wss://relay.snort.social/"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const authorize = async (pubkey) => {
|
const authorize = async (pubkey) => {
|
||||||
@ -49,7 +49,6 @@ const authorize = async (pubkey) => {
|
|||||||
} else {
|
} else {
|
||||||
// Create user
|
// Create user
|
||||||
if (profile) {
|
if (profile) {
|
||||||
track('Nostr Signup', { pubkey: pubkey });
|
|
||||||
const fields = await findKind0Fields(profile);
|
const fields = await findKind0Fields(profile);
|
||||||
const payload = { pubkey, username: fields.username, avatar: fields.avatar };
|
const payload = { pubkey, username: fields.username, avatar: fields.avatar };
|
||||||
|
|
||||||
@ -115,9 +114,6 @@ export const authOptions = {
|
|||||||
},
|
},
|
||||||
from: process.env.EMAIL_FROM,
|
from: process.env.EMAIL_FROM,
|
||||||
sendVerificationRequest: async ({ identifier, url, provider }) => {
|
sendVerificationRequest: async ({ identifier, url, provider }) => {
|
||||||
// Track the email signup event
|
|
||||||
track('Email Signup', { email: identifier });
|
|
||||||
|
|
||||||
// Use nodemailer to send the email
|
// Use nodemailer to send the email
|
||||||
const transport = nodemailer.createTransport(provider.server);
|
const transport = nodemailer.createTransport(provider.server);
|
||||||
await transport.sendMail({
|
await transport.sendMail({
|
||||||
@ -148,8 +144,6 @@ export const authOptions = {
|
|||||||
const sk = generateSecretKey();
|
const sk = generateSecretKey();
|
||||||
pubkey = getPublicKey(sk);
|
pubkey = getPublicKey(sk);
|
||||||
privkey = bytesToHex(sk);
|
privkey = bytesToHex(sk);
|
||||||
console.log('pubkey', pubkey);
|
|
||||||
console.log('privkey', privkey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if user exists in the database
|
// Check if user exists in the database
|
||||||
|
Loading…
x
Reference in New Issue
Block a user