correction flow 7
This commit is contained in:
parent
94e8e89717
commit
36046ab35b
2
.env
2
.env
@ -42,5 +42,5 @@ NEXT_PUBLIC_IFRAME_AI_ASSISTANT_URL=https://alma.slm-lab.net
|
|||||||
|
|
||||||
ROCKET_CHAT_TOKEN=w91TYgkH-Z67Oz72usYdkW5TZLLRwnre7qyAhp7aHJB
|
ROCKET_CHAT_TOKEN=w91TYgkH-Z67Oz72usYdkW5TZLLRwnre7qyAhp7aHJB
|
||||||
ROCKET_CHAT_USER_ID=Tpuww59PJKsrGNQJB
|
ROCKET_CHAT_USER_ID=Tpuww59PJKsrGNQJB
|
||||||
LEANTIME_API_KEY=lt_lsdShQdoYHaPUWuL07XZR1Rf3GeySsIs_UDlll3VJPk5EwAuILpMC4BwzJ9MZFRrb
|
LEANTIME_TOKEN=lt_lsdShQdoYHaPUWuL07XZR1Rf3GeySsIs_UDlll3VJPk5EwAuILpMC4BwzJ9MZFRrb
|
||||||
LEANTIME_API_URL=https://agilite.slm-lab.net
|
LEANTIME_API_URL=https://agilite.slm-lab.net
|
||||||
@ -206,13 +206,15 @@ async function createLeantimeUser(userData: {
|
|||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
email: string;
|
email: string;
|
||||||
|
password: string;
|
||||||
}): Promise<{ success: boolean; error?: string }> {
|
}): Promise<{ success: boolean; error?: string }> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('https://agilite.slm-lab.net/index.php/api/jsonrpc', {
|
const response = await fetch('https://agilite.slm-lab.net/api/jsonrpc', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'x-api-key': process.env.LEANTIME_API_KEY!,
|
'Authorization': `Bearer ${process.env.LEANTIME_TOKEN}`,
|
||||||
|
'X-API-Key': process.env.LEANTIME_TOKEN || '',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
method: 'leantime.rpc.Users.Users.addUser',
|
method: 'leantime.rpc.Users.Users.addUser',
|
||||||
@ -224,9 +226,9 @@ async function createLeantimeUser(userData: {
|
|||||||
lastname: userData.lastName,
|
lastname: userData.lastName,
|
||||||
username: userData.username,
|
username: userData.username,
|
||||||
email: userData.email,
|
email: userData.email,
|
||||||
|
password: userData.password,
|
||||||
status: 'active',
|
status: 'active',
|
||||||
role: 'user', // Default role in Leantime
|
role: 'user', // Default role in Leantime
|
||||||
password: Math.random().toString(36).slice(-8), // Generate a random password
|
|
||||||
source: 'keycloak',
|
source: 'keycloak',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,7 +242,7 @@ async function createLeantimeUser(userData: {
|
|||||||
console.error('Leantime user creation failed:', data);
|
console.error('Leantime user creation failed:', data);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: 'Failed to create user in Leantime'
|
error: data.error?.message || 'Failed to create user in Leantime'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,6 +418,7 @@ export async function POST(req: Request) {
|
|||||||
firstName: data.firstName,
|
firstName: data.firstName,
|
||||||
lastName: data.lastName,
|
lastName: data.lastName,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
|
password: data.password,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!leantimeResult.success) {
|
if (!leantimeResult.success) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user