feat: Registration page
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
<textarea
|
||||
rows="5"
|
||||
class={disabledClass}
|
||||
class:pr-10={true}
|
||||
class:pr-20={value && isHttps}
|
||||
{placeholder}
|
||||
type="text"
|
||||
{id}
|
||||
@@ -44,6 +46,8 @@
|
||||
<input
|
||||
class={disabledClass}
|
||||
type="text"
|
||||
class:pr-10={true}
|
||||
class:pr-20={value && isHttps}
|
||||
{id}
|
||||
{name}
|
||||
{required}
|
||||
@@ -57,6 +61,8 @@
|
||||
{:else}
|
||||
<input
|
||||
class={disabledClass}
|
||||
class:pr-10={true}
|
||||
class:pr-20={value && isHttps}
|
||||
type="password"
|
||||
{id}
|
||||
{name}
|
||||
|
||||
@@ -10,13 +10,18 @@ export async function hashPassword(password: string) {
|
||||
const saltRounds = 15;
|
||||
return bcrypt.hash(password, saltRounds);
|
||||
}
|
||||
export async function login({ email, password }) {
|
||||
export async function login({ email, password, isLogin }) {
|
||||
const users = await prisma.user.count();
|
||||
const userFound = await prisma.user.findUnique({
|
||||
where: { email },
|
||||
include: { teams: true, permission: true },
|
||||
rejectOnNotFound: false
|
||||
});
|
||||
if (!userFound && isLogin) {
|
||||
throw {
|
||||
error: 'Wrong password or email address.'
|
||||
};
|
||||
}
|
||||
// Registration disabled if database is not seeded properly
|
||||
const { isRegistrationEnabled, id } = await db.listSettings();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const publicPaths = [
|
||||
'/login',
|
||||
'/register',
|
||||
'/reset',
|
||||
'/reset/password',
|
||||
'/webhooks/success',
|
||||
|
||||
Reference in New Issue
Block a user