Commit cd671864 by Ali Arshad

Merge branch 'user-registration' into 'master'

Users Listing

See merge request jibc/jibc-meteor-api!4
parents 62f4082d 7431838a
......@@ -9,6 +9,8 @@ export const PERMISSIONS = {
CAN_ACCESS_SETTINGS: 'CAN_ACCESS_SETTINGS',
CAN_ACCESS_EMAIL_TEMPLATES: 'CAN_ACCESS_EMAIL_TEMPLATES',
CAN_UPDATE_ALL_USERS: 'CAN_UPDATE_ALL_USERS',
CAN_ACCESS_USERS_PAGE: 'CAN_ACCESS_USERS_PAGE',
CAN_ACCESS_PROFILE: 'CAN_ACCESS_PROFILE',
};
export const CONFIG = {
......
......@@ -3,9 +3,17 @@ import { rolesCollection } from '../collections/role.collection';
import { ERR, E_CODE, PERMISSIONS } from '../config';
import { UtilsService } from '../services/utils.service';
import { EmailService } from '../services/email.service';
import { QueryModel } from '../models/query.model';
Meteor.methods({
usersGetCount(query: QueryModel): any {
return {
recordsFiltered: Meteor.users.find(query.query).count(),
recordsTotal: Meteor.users.find().count(),
};
},
registerUser(user: any): string {
const defaultRole = rolesCollection.findOne({ title: user.role });
......
......@@ -19,7 +19,7 @@ Migrations.add({
rolesCollection.insert({
title: 'User',
permissions: [PERMISSIONS.CAN_LOGIN, PERMISSIONS.CAN_UPDATE_OWN_USER,
PERMISSIONS.CAN_ACCESS_DASHBOARD_PAGE],
PERMISSIONS.CAN_ACCESS_DASHBOARD_PAGE, PERMISSIONS.CAN_ACCESS_PROFILE],
description: '',
});
rolesCollection.insert({
......@@ -57,6 +57,15 @@ Migrations.add({
role: rolesCollection.findOne({ title: 'User' })._id,
},
});
Accounts.createUser({
username: 'user',
password: 'User1234',
email: 'user@vqode.com',
profile: {
name: 'User',
role: rolesCollection.findOne({ title: 'User' })._id,
},
});
}
},
});
......@@ -70,7 +79,7 @@ Migrations.add({
settingsCollection.insert({
Key: 'REGISTER',
Value: {
SUBJECT: 'Welcome to $platform',
SUBJECT: 'Welcome to My Platform',
CONTENT: 'Hi $name! You are our $role now. Please click on the link <a href="$link" target="_blank">$link</a> to verify your account.',
},
Description: 'Register Email Template',
......@@ -82,7 +91,7 @@ Migrations.add({
settingsCollection.insert({
Key: 'RESET',
Value: {
SUBJECT: 'Reset Password for $platform',
SUBJECT: 'Reset Password for My Platform',
CONTENT: 'Hi $name! Don\'t worry. Reset your password by clicking on the following link <a href="$link" target="_blank">$link</a>.',
},
Description: 'Reset Password Email Template',
......
......@@ -70,7 +70,6 @@ export class EmailService {
static formattedContent(content: string, name: string, role: string, email, link = null): string {
const str = content.replace(/\$name/g, name)
.replace(/\$role/g, role)
.replace(/\$platform/g, CONFIG.SiteName)
.replace(/\$email/g, email);
return link ? str.replace(/\$link/g, link) : str;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment