added isImported query param to handle user account creation depending on where user creation comes from
MODIFY
src/assets/server/rest/v1/schemas/auth/auth-verify-email.json
src/assets/server/rest/v1/schemas/auth/auth-verify-email.json
"VerificationToken": {
"type": "string",
"sanitize": "mongo"
+ },
+ "IsImported": {
+ "type": "boolean",
+ "sanitize": "mongo"
}
},
"required": [

MODIFY
src/async-task/tasks/UsersImportAsyncTask.ts
src/async-task/tasks/UsersImportAsyncTask.ts
@@ -106,7 +106,7 @@ export default class UsersImportAsyncTask extends AbstractAsyncTask {
// Build account verif email with reset password embeded
const evseDashboardVerifyEmailURL = Utils.buildEvseURL(tenant.subdomain) +
'/verify-email?VerificationToken=' + verificationToken + '&Email=' +
- newUser.email + '&ResetToken=' + resetHash;
+ newUser.email + '&ResetToken=' + resetHash + '&isImported=true';
// Send activate account link
await NotificationHandler.sendVerificationEmailUserImport(
tenant.id,

MODIFY
src/server/rest/v1/service/AuthService.ts
src/server/rest/v1/service/AuthService.ts
@@ -258,7 +258,7 @@ export default class AuthService {
if (tenantID !== Constants.DEFAULT_TENANT) {
// Send notification
const evseDashboardVerifyEmailURL = Utils.buildEvseURL(filteredRequest.tenant) +
- '/verify-email?VerificationToken=' + verificationToken + '&Email=' + newUser.email;
+ '/verify-email?VerificationToken=' + verificationToken + '&Email=' + newUser.email + '&isImported=false';
// Notify (Async)
NotificationHandler.sendNewRegisteredUser(
tenantID,
@@ -520,10 +520,15 @@ export default class AuthService {
message: 'Wrong Verification Token'
});
}
+ let userStatus: UserStatus;
+ if (!filteredRequest.IsImported) {
const userSettings = await SettingStorage.getUserSettings(tenantID);
- const userStatus = userSettings.user.autoActivateAccountAfterValidation ? UserStatus.ACTIVE : UserStatus.INACTIVE;
- // Save User Status
+ userStatus = userSettings.user.autoActivateAccountAfterValidation ? UserStatus.ACTIVE : UserStatus.INACTIVE;
await UserStorage.saveUserStatus(tenantID, user.id, userStatus);
+ } else {
+ await UserStorage.saveUserStatus(tenantID, user.id, UserStatus.PENDING);
+ }
+ // Save User Status
// For integration with billing
const billingImpl = await BillingFactory.getBillingImpl(tenant);
if (billingImpl) {
@@ -666,7 +671,7 @@ export default class AuthService {
// Send notification
const evseDashboardVerifyEmailURL = Utils.buildEvseURL(filteredRequest.tenant) +
'/verify-email?VerificationToken=' + verificationToken + '&Email=' +
- user.email;
+ user.email + '&isImported=false';
// Send Verification Email (Async)
NotificationHandler.sendVerificationEmail(
tenantID,

MODIFY
src/server/rest/v1/service/TenantService.ts
src/server/rest/v1/service/TenantService.ts
@@ -285,7 +285,7 @@ export default class TenantService {
// Send activation link
const evseDashboardVerifyEmailURL = Utils.buildEvseURL(filteredRequest.subdomain) +
'/verify-email?VerificationToken=' + verificationToken + '&Email=' +
- tenantUser.email + '&ResetToken=' + resetHash;
+ tenantUser.email + '&ResetToken=' + resetHash + '&isImported=false';
// Send Register User (Async)
NotificationHandler.sendNewRegisteredUser(
filteredRequest.id,

MODIFY
src/types/Transaction.ts
src/types/Transaction.ts
@@ -43,7 +43,8 @@ export enum StartTransactionErrorCode {
BILLING_NO_TAX = 'billing_no_tax', // start transaction is not possible - the tax ID is not set or inconsistent
BILLING_NO_SETTINGS = 'billing_no_settings', // start transaction not possible - billing settings are not set (or partially set)
BILLING_INCONSISTENT_SETTINGS = 'billing_inconsistent_settings', // start transaction not possible - billing settings are inconsistent
- EULA_NOT_ACCEPTED = 'eula_not_accepted',
+ // EULA not accepted : should never be possible with remote start from the app - to be checked if needed in frontend
+ EULA_NOT_ACCEPTED = 'eula_not_accepted', // start transaction not possible - user has never accepted the eula (use case : user import + user has never log into the app)
}
export default interface Transaction extends AbstractCurrentConsumption {

added isImported query param to handle user account creation depending on where user creation comes from