Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
angular-meteor
api
Commits
cd671864
You need to sign in or sign up before continuing.
Commit
cd671864
authored
Dec 26, 2019
by
Ali Arshad
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'user-registration' into 'master'
Users Listing See merge request jibc/jibc-meteor-api!4
parents
62f4082d
7431838a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
4 deletions
+22
-4
config.ts
server/config.ts
+2
-0
users.method.ts
server/methods/users.method.ts
+8
-0
migrations.ts
server/migrations.ts
+12
-3
email.service.ts
server/services/email.service.ts
+0
-1
No files found.
server/config.ts
View file @
cd671864
...
...
@@ -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
=
{
...
...
server/methods/users.method.ts
View file @
cd671864
...
...
@@ -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
});
...
...
server/migrations.ts
View file @
cd671864
...
...
@@ -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
$p
latform'
,
SUBJECT
:
'Welcome to
My P
latform'
,
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
$p
latform'
,
SUBJECT
:
'Reset Password for
My P
latform'
,
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'
,
...
...
server/services/email.service.ts
View file @
cd671864
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment