Commit bea06ff0b863eee33d23e2f2e7eb342cac47c9f0

Authored by Deepak
1 parent d75229d74e
Exists in master

Fixed teachers view

imports/client/views/nonOrg/app/module/AppLayout.js
1 import _ from 'lodash'; 1 import _ from 'lodash';
2 import { Meteor } from 'meteor/meteor'; 2 import { Meteor } from 'meteor/meteor';
3 import React, { Component } from 'react'; 3 import React, { Component } from 'react';
4 import { Link } from 'react-router'; 4 import { Link } from 'react-router';
5 import { Avatar } from '/imports/client/components/Avatar'; 5 import { Avatar } from '/imports/client/components/Avatar';
6 import { Icon } from '/imports/client/components/Icon'; 6 import { Icon } from '/imports/client/components/Icon';
7 import classNames from 'classnames'; 7 import classNames from 'classnames';
8 8
9 import { logout } from '/imports/client/app/utils/loginMethods'; 9 import { logout } from '/imports/client/app/utils/loginMethods';
10 import { VerifyModule } from '/imports/client/views/verify/module/index' 10 import { VerifyModule } from '/imports/client/views/verify/module/index'
11 11
12 import Signup from '/imports/client/views/nonOrg/enter/SignupView'; 12 import Signup from '/imports/client/views/nonOrg/enter/SignupView';
13 import { Collapse, Navbar, NavbarToggler, 13 import { Collapse, Navbar, NavbarToggler,
14 NavbarBrand, Nav, NavItem, NavLink } from 'reactstrap'; 14 NavbarBrand, Nav, NavItem, NavLink } from 'reactstrap';
15 15
16 16
17 export class AppLayout extends Component { 17 export class AppLayout extends Component {
18 constructor(props) { 18 constructor(props) {
19 super(props); 19 super(props);
20 20
21 this.toggle = this.toggle.bind(this); 21 this.toggle = this.toggle.bind(this);
22 this.state = { 22 this.state = {
23 isOpen: false 23 isOpen: false
24 }; 24 };
25 } 25 }
26 toggle() { 26 toggle() {
27 this.setState({ 27 this.setState({
28 isOpen: !this.state.isOpen 28 isOpen: !this.state.isOpen
29 }); 29 });
30 } 30 }
31 render() { 31 render() {
32 const {user, org} = this.props.data; 32 const {user, org} = this.props.data;
33 console.log(user); 33 console.log(user);
34 console.log(org); 34 console.log(org);
35 if(!user) { 35 if(!user) {
36 return ( 36 return (
37 <Signup 37 <Signup
38 /> 38 />
39 ); 39 );
40 } 40 }
41 41
42 if(!user.isEmailVerified()) { 42 if(!user.isEmailVerified()) {
43 return ( 43 return (
44 <VerifyModule 44 <VerifyModule
45 pane = {this.props.location.query.verify} 45 pane = {this.props.location.query.verify}
46 location = {this.props.location} 46 location = {this.props.location}
47 /> 47 />
48 ); 48 );
49 } 49 }
50 const theUrl = Meteor.absoluteUrl(); 50 const theUrl = Meteor.absoluteUrl();
51 OrgUrl = theUrl.replace("http://","http://"+org.slug+"."); 51 OrgUrl = theUrl.replace("http://","http://"+org.slug+".");
52 return ( 52 return (
53 <div className = "appLayout-box"> 53 <div className = "appLayout-box">
54 <Navbar color="faded" light toggleable>
55 <NavbarToggler right onClick={this.toggle} />
56 <NavbarBrand href="/">reactstrap</NavbarBrand>
57 <Collapse isOpen={this.state.isOpen} navbar>
58 <Nav className="ml-auto" navbar>
59 <NavItem>
60 <NavLink href="/components/">Components</NavLink>
61 </NavItem>
62 <NavItem>
63 <NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink>
64 </NavItem>
65 </Nav>
66 </Collapse>
67 </Navbar>
68 <div className = "appLayout-wrapOuter"> 54 <div className = "appLayout-wrapOuter">
69 <div className = "appLayout-wrapInner"> 55 <div className = "appLayout-wrapInner">
70 <div className = "appLayout-menuWrap"> 56 <div className = "appLayout-menuWrap">
71 </div> 57 </div>
72 <div className = "appLayout-contentWrap"> 58 <div className = "appLayout-contentWrap">
73 <div className = "appLayout-content"> 59 <div className = "appLayout-content">
74 Hi, {user.getFullName()}, 60 Hi, {user.getFullName()},
75 Please visit your organization page by <a href={OrgUrl}>clicking here </a> and login using your credentials! 61 Please visit your organization page by <a href={OrgUrl}>clicking here </a> and login using your credentials!
76 </div> 62 </div>
77 </div> 63 </div>
78 </div> 64 </div>
79 </div> 65 </div>
80 </div> 66 </div>
81 ); 67 );
82 }; 68 };
83 69
84 }; 70 };
85 71
imports/client/views/org/enter/loginpane.css
1 .enterPane__box 1 .enterPane__box
2 { 2 {
3 margin: 20px auto; 3 margin: 150px auto;
4 width: 400px; 4 width: 400px;
5 height: 100%; 5 height: 280px;
6 padding: 20px; 6 padding: 10px;
7 float:right;
8 -webkit-border-radius: 8px/7px; 7 -webkit-border-radius: 8px/7px;
9 -moz-border-radius: 8px/7px; 8 -moz-border-radius: 8px/7px;
10 border-radius: 8px/7px; 9 border-radius: 8px/7px;
11 background-color: white; 10 background-color: white;
12 -webkit-box-shadow: 1px 2px 5px rgba(0,0,0,.31); 11 -webkit-box-shadow: 1px 2px 5px rgba(0,0,0,.31);
13 -moz-box-shadow: 1px 2px 5px rgba(0,0,0,.31); 12 -moz-box-shadow: 1px 2px 5px rgba(0,0,0,.31);
14 box-shadow: 1px 2px 5px rgba(0,0,0,.31); 13 box-shadow: 1px 2px 5px rgba(0,0,0,.31);
15 border: solid 1px #cbc9c9; 14 border: solid 1px #cbc9c9;
16 font-family: 'Ubuntu', sans-serif; 15 font-family: 'Ubuntu', sans-serif;
17 } 16 }
18 17
19 .enterPane__header 18 .enterPane__header
20 { 19 {
21 text-align: center; 20 text-align: center;
22 color:#00b395; 21 color:#00b395;
23 font-weight: bolder; 22 font-weight: bolder;
24 } 23 }
25 24
26 .blue { 25 .blue {
27 background-color: #00b395; 26 background-color: #00b395;
28 background-image: -webkit-linear-gradient(top,#00b395,#00cdaa); 27 background-image: -webkit-linear-gradient(top,#00b395,#00cdaa);
29 background-image: -moz-linear-gradient(top,#00b395,#00cdaa); 28 background-image: -moz-linear-gradient(top,#00b395,#00cdaa);
30 background-image: -ms-linear-gradient(top,#00b395,#00cdaa); 29 background-image: -ms-linear-gradient(top,#00b395,#00cdaa);
31 background-image: -o-linear-gradient(top,#00b395,#00cdaa); 30 background-image: -o-linear-gradient(top,#00b395,#00cdaa);
32 background-image: linear-gradient(top,#00b395,#00cdaa); 31 background-image: linear-gradient(top,#00b395,#00cdaa);
33 32
34 border: 1px solid #00b395; 33 border: 1px solid #00b395;
35 color: white; 34 color: white;
36 35
37 font-size: 13px; 36 font-size: 13px;
38 font-weight: bold; 37 font-weight: bold;
39 text-align: center; 38 text-align: center;
40 height: 27px; 39 height: 27px;
41 line-height: 27px; 40 line-height: 27px;
42 min-width: 54px; 41 min-width: 54px;
43 padding: 0 10px; 42 padding: 0 10px;
44 text-decoration: none; 43 text-decoration: none;
45 } 44 }
46 45
47 .form-group 46 /*.form-group
48 { 47 {
49 clear:both; 48 clear:both;
50 } 49 }*/
51 50
52 .enterPane__link 51 .enterPane__link
53 { 52 {
54 text-decoration: underline; 53 text-decoration: underline;
55 } 54 }
56 55
57 .blue:hover { 56 .blue:hover {
58 border: 1px solid #00b395; 57 border: 1px solid #00b395;
59 58
60 color: white; 59 color: white;
61 background-color: #00b395; 60 background-color: #00b395;
62 background-image: -webkit-linear-gradient(top,#00b395,#009f85); 61 background-image: -webkit-linear-gradient(top,#00b395,#009f85);
63 background-image: -moz-linear-gradient(top,#00b395,#009f85); 62 background-image: -moz-linear-gradient(top,#00b395,#009f85);
64 background-image: -ms-linear-gradient(top,#00b395,#009f85); 63 background-image: -ms-linear-gradient(top,#00b395,#009f85);
65 background-image: -o-linear-gradient(top,#00b395,#009f85); 64 background-image: -o-linear-gradient(top,#00b395,#009f85);
66 background-image: linear-gradient(top,#00b395,#009f85); 65 background-image: linear-gradient(top,#00b395,#009f85);
67 66
68 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.1); 67 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.1);
69 -moz-box-shadow: 0 1px 1px rgba(0,0,0,.1); 68 -moz-box-shadow: 0 1px 1px rgba(0,0,0,.1);
70 box-shadow: 0 1px 1px rgba(0,0,0,.1); 69 box-shadow: 0 1px 1px rgba(0,0,0,.1);
71 width: auto; 70 width: auto;
72 height: 27px; 71 height: 27px;
73 } 72 }
74 73
imports/collections/students/serverCsvUpload.js
1 // import { } from '/imports/collections/orgs/methods'; 1 // import { } from '/imports/collections/orgs/methods';
2 import _ from 'lodash'; 2 import _ from 'lodash';
3 import { Meteor } from 'meteor/meteor'; 3 import { Meteor } from 'meteor/meteor';
4 import Papa from 'meteor/harrison:papa-parse' 4 import Papa from 'meteor/harrison:papa-parse'
5 import csv from 'csv2json-convertor' 5 import csv from 'csv2json-convertor'
6 import { ValidatedMethod } from 'meteor/mdg:validated-method'; 6 import { ValidatedMethod } from 'meteor/mdg:validated-method';
7 import { SimpleSchema } from 'meteor/aldeed:simple-schema'; 7 import { SimpleSchema } from 'meteor/aldeed:simple-schema';
8 import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; 8 import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
9 import { Bert } from 'meteor/themeteorchef:bert'; 9 import { Bert } from 'meteor/themeteorchef:bert';
10 import { Users } from '/imports/collections/users/index'; 10 import { Users } from '/imports/collections/users/index';
11 import { Orgs } from '/imports/collections/orgs/index'; 11 import { Orgs } from '/imports/collections/orgs/index';
12 import { Students } from '/imports/collections/students/index' 12 import { Students } from '/imports/collections/students/index'
13 import { Parents } from '/imports/collections/parents/index'; 13 import { Parents } from '/imports/collections/parents/index';
14 import csv1 from 'csv2json-convertor' 14 import csv1 from 'csv2json-convertor'
15 import json2csv from 'json2csv' 15 import json2csv from 'json2csv'
16 import fs from 'fs' 16 import fs from 'fs'
17 import Validation from '/imports/validation/validationMethods'; 17 import Validation from '/imports/validation/validationMethods';
18 import Constants from '/imports/constants/constants' 18 import Constants from '/imports/constants/constants'
19 19
20 export const studenCsvtMethod = new ValidatedMethod({ 20 export const studenCsvtMethod = new ValidatedMethod({
21 name: 'student.csvMethod', 21 name: 'student.csvMethod',
22 22
23 validate: new SimpleSchema({ 23 validate: new SimpleSchema({
24 itemId: { type: String }, 24 itemId: { type: String },
25 }).validator(), 25 }).validator(),
26 26
27 run({itemId}) { 27 run({itemId}) {
28 return {}; 28 return {};
29 }, 29 },
30 30
31 }); 31 });
32 32
33 export const save_csv_data = new ValidatedMethod({ 33 export const save_csv_data = new ValidatedMethod({
34 name: 'save_csv_data', 34 name: 'save_csv_data',
35 35
36 validate: null, 36 validate: null,
37 37
38 run({item,filename,csv_fiels}) { 38 run({item,filename,csv_fiels}) {
39 var csv = json2csv({ 39 var csv = json2csv({
40 data: item, 40 data: item,
41 fields: csv_fiels 41 fields: csv_fiels
42 }); 42 });
43 fs.writeFile(filename, csv,function(err) { 43 fs.writeFile(filename, csv,function(err) {
44 if (err) throw err; 44 if (err) throw err;
45 }); 45 });
46 }, 46 },
47 }); 47 });
48 48
49 export const addStudentCSV= new ValidatedMethod({ 49 export const addStudentCSV= new ValidatedMethod({
50 name: 'student.addCSV', 50 name: 'student.addCSV',
51 51
52 validate: null, 52 validate: null,
53 53
54 run(item){ 54 run(item){
55 data = item ; 55 data = item ;
56 console.log("data"); 56 console.log("data");
57 console.log(data); 57 console.log(data);
58 // return true; 58 // return true;
59 const user = Users.findOne({_id: this.userId}); 59 const user = Users.findOne({_id: this.userId});
60 orgId = user.orgId; 60 orgId = user.orgId;
61 newStudentId = Users.insert({ 61 newStudentId = Users.insert({
62 // emails: [{address:data.email, verified: false}], 62 // emails: [{address:data.email, verified: false}],
63 //username: data["First Name*"], 63 //username: data["First Name*"],
64 firstName: data["First Name*"], 64 firstName: data["First Name*"],
65 lastName: data['Last Name*'], 65 lastName: data['Last Name*'],
66 orgId: orgId, 66 orgId: orgId,
67 role: 'STUDENT' 67 role: 'STUDENT'
68 }); 68 });
69 newParentUserId = Users.insert({ 69 newParentUserId = Users.insert({
70 //emails: [{address:data.parentEmail, verified: false}], 70 //emails: [{address:data.parentEmail, verified: false}],
71 //username: data['Parent Name*'], 71 //username: data['Parent Name*'],
72 firstName: data['Parent Name*'], 72 firstName: data['Parent Name*'],
73 orgId: orgId, 73 orgId: orgId,
74 role: 'PARENT' 74 role: 'PARENT'
75 }); 75 });
76 if(newParentUserId){ 76 if(newParentUserId){
77 newParentId = Parents.insert({ 77 newParentId = Parents.insert({
78 userId: newParentUserId, 78 userId: newParentUserId,
79 orgId: orgId, 79 orgId: orgId,
80 }); 80 });
81 console.log("newParentUserId"); 81 console.log("newParentUserId");
82 console.log(newParentUserId); 82 console.log(newParentUserId);
83 } 83 }
84 console.log("newUserId"); 84 console.log("newUserId");
85 console.log(newStudentId); 85 console.log(newStudentId);
86 if(newStudentId){ 86 if(newStudentId){
87 Students.insert({ 87 Students.insert({
88 userId: newStudentId, 88 userId: newStudentId,
89 orgId: orgId, 89 orgId: orgId,
90 admissionId: data['Student Admission ID*'], 90 admissionId: data['Student Admission ID*'],
91 address: data['Student Admission ID*'], 91 address: data['Student Admission ID*'],
92 gender: data['Gender(male/female)*'], 92 gender: data['Gender(male/female)*'],
93 dob: data['Birthday(YYYY-MM-DD)*'], 93 dob: data['Birthday(YYYY-MM-DD)*'],
94 rollNo: data['Student Roll*'], 94 rollNo: data['Student Roll*'],
95 class: data['Student Class Name*'], 95 class: data['Student Class Name*'],
96 section: data['Student Section Name*'], 96 section: data['Student Section Name*'],
97 bloodGroup: data['Blood Group*'], 97 bloodGroup: data['Blood Group*'],
98 community: data['Community'], 98 community: data['Community'],
99 parent: [{id: newParentUserId, relatinship: data['Parent Relation*']}] 99 parent: [{id: newParentUserId, relatinship: data['Parent Relation*']}]
100 }); 100 });
101 } 101 }
102 return {newStudentId}; 102 return {newStudentId};
103 }, 103 },
104 104
105 }); 105 });
106 106
107 export const studentUploadCsv = new ValidatedMethod({ 107 export const studentUploadCsv = new ValidatedMethod({
108 name: 'student.uploadCsv', 108 name: 'student.uploadCsv',
109 109
110 validate: null, 110 validate: null,
111 111
112 run({data}) { 112 run({data}) {
113 let validation = new Validation(); 113 let validation = new Validation();
114 let constants = new Constants(); 114 let constants = new Constants();
115 //console.log("++++++++++++++++++++++++"+constants.csv_students_data()); 115 //console.log("++++++++++++++++++++++++"+constants.csv_students_data());
116 temp = constants.csv_students_data(); 116 temp = constants.csv_students_data();
117 // 117 //
118 console.log(temp); 118 console.log(temp);
119 // var data_1=csv1.csvtojson(("/Users/satheeshnagaraj/Downloads/11.csv")); //csvtojson is function that accepts csv filenames and returns JSON object 119 // var data_1=csv1.csvtojson(("/Users/satheeshnagaraj/Downloads/11.csv")); //csvtojson is function that accepts csv filenames and returns JSON object
120 //console.log(data);'' 120 //console.log(data);''
121 // Stores = new Mongo.Collection('stores'); 121 // Stores = new Mongo.Collection('stores');
122 // data = data_1; 122 // data = data_1;
123 123
124 var CSV_valid_buffer = []; 124 var CSV_valid_buffer = [];
125 var CSV_invalid_buffer = []; 125 var CSV_invalid_buffer = [];
126 var filename = new Date().getTime().toString(); 126 var filename = new Date().getTime().toString();
127 var csv_filepath = '/Users/satheeshnagaraj/Documents/Workspace/Meteor/Youngdesk/ydapp/CSV_Files/'; 127 var csv_filepath = './CSV_Files/';
128 128
129 129
130 for (let i = 0; i < data.length; i++) 130 for (let i = 0; i < data.length; i++)
131 { 131 {
132 132
133 //let item= {Errors:""}; 133 //let item= {Errors:""};
134 let item = data[i]; 134 let item = data[i];
135 delete item['Errors']; 135 delete item['Errors'];
136 var formate_validation = 1; 136 var formate_validation = 1;
137 var is_not_null = 1; 137 var is_not_null = 1;
138 var errors = []; 138 var errors = [];
139 for (var key in item) 139 for (var key in item)
140 { 140 {
141 var value = item[key]; 141 var value = item[key];
142 var n = key.indexOf("*"); 142 var n = key.indexOf("*");
143 if(n!=-1) { 143 if(n!=-1) {
144 if(!(validation.notNull(value))) 144 if(!(validation.notNull(value)))
145 { 145 {
146 errors.push(key+"is Empty"); 146 errors.push(key+"is Empty");
147 } 147 }
148 is_not_null = is_not_null && validation.notNull(value); 148 is_not_null = is_not_null && validation.notNull(value);
149 } 149 }
150 } 150 }
151 //console.log(validation.mobileNumber(item["Parent Mobile*"])); 151 //console.log(validation.mobileNumber(item["Parent Mobile*"]));
152 152
153 153
154 154
155 155
156 var formate_validation = validation.validateEmail(item["Parent Email*"]) && validation.mobileNumber(item["Parent Mobile*"]) ; //&& validation.validateEmail(item["Parent Mobile"]) ); 156 var formate_validation = validation.validateEmail(item["Parent Email*"]) && validation.mobileNumber(item["Parent Mobile*"]) ; //&& validation.validateEmail(item["Parent Mobile"]) );
157 157
158 if (!(validation.validateEmail(item["Parent Email*"]))) 158 if (!(validation.validateEmail(item["Parent Email*"])))
159 { 159 {
160 errors.push('Parent Email is invalid'); 160 errors.push('Parent Email is invalid');
161 } 161 }
162 if (!(validation.mobileNumber(item["Parent Mobile*"]))) 162 if (!(validation.mobileNumber(item["Parent Mobile*"])))
163 { 163 {
164 errors.push('Parent Mobile is invalid'); 164 errors.push('Parent Mobile is invalid');
165 } 165 }
166 166
167 var is_valid = formate_validation && is_not_null ; 167 var is_valid = formate_validation && is_not_null ;
168 168
169 // console.log(formate_validation); 169 // console.log(formate_validation);
170 if (is_valid) 170 if (is_valid)
171 { 171 {
172 CSV_valid_buffer.push(item); 172 CSV_valid_buffer.push(item);
173 console.log("----------------------------------------1"); 173 console.log("----------------------------------------1");
174 Meteor.call('student.addCSV',item); 174 Meteor.call('student.addCSV',item);
175 console.log("----------------------------------------2"); 175 console.log("----------------------------------------2");
176 176
177 // exists = Stores.findOne({ 177 // exists = Stores.findOne({
178 // "Student 'Admission' ID*": item["Student Admission ID*"] 178 // "Student 'Admission' ID*": item["Student Admission ID*"]
179 // }); 179 // });
180 // if (!exists) 180 // if (!exists)
181 // { 181 // {
182 // Stores.insert(item); 182 // Stores.insert(item);
183 // } 183 // }
184 // else 184 // else
185 // { 185 // {
186 // console.warn('Rejected. This item already exists.'); 186 // console.warn('Rejected. This item already exists.');
187 // } 187 // }
188 } 188 }
189 else 189 else
190 { 190 {
191 var str = errors.toString(); 191 var str = errors.toString();
192 item.Errors = str; 192 item.Errors = str;
193 CSV_invalid_buffer.push(item); 193 CSV_invalid_buffer.push(item);
194 //console.log(str); 194 //console.log(str);
195 // console.log(CSV_invalid_buffer); 195 // console.log(CSV_invalid_buffer);
196 } 196 }
197 } 197 }
198 console.log(csv_filepath+filename+"_CSV_invalid_data"+".csv"); 198 console.log(csv_filepath+filename+"_CSV_invalid_data"+".csv");
199 199
200 Meteor.call('save_csv_data',{ item : CSV_invalid_buffer, filename: csv_filepath+filename+"_CSV_invalid_data"+".csv",csv_fiels :constants.csv_students_data()}); 200 Meteor.call('save_csv_data',{ item : CSV_invalid_buffer, filename: csv_filepath+filename+"_CSV_invalid_data"+".csv",csv_fiels :constants.csv_students_data()});
201 Meteor.call('save_csv_data',{ item : CSV_valid_buffer,filename: csv_filepath+filename+"_CSV_valid_data"+".csv",csv_fiels :constants.csv_students_data()}); 201 Meteor.call('save_csv_data',{ item : CSV_valid_buffer,filename: csv_filepath+filename+"_CSV_valid_data"+".csv",csv_fiels :constants.csv_students_data()});
202 return {}; 202 return {};
203 }, 203 },
204 204
205 }); 205 });
206 206
imports/server/pages/verifyEmail.js
1 import React from 'react'; 1 import React from 'react';
2 import _ from 'lodash'; 2 import _ from 'lodash';
3 import { Users } from '/imports/collections/users/index'; 3 import { Users } from '/imports/collections/users/index';
4 4
5 5
6 6
7 7
8 const finishWithMessage = (res, message, redirect = "/") => { 8 const finishWithMessage = (res, message, redirect = "/") => {
9 9
10 const output = ` 10 const output = `
11 <html> 11 <html>
12 <head> 12 <head>
13 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css"> 13 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css">
14 <!-- Latest compiled and minified CSS --> 14 <!-- Latest compiled and minified CSS -->
15 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 15 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
16 <style type="text/css"> 16 <style type="text/css">
17
17 .congo-wrap .header { 18 .congo-wrap .header {
18 background: #379AC7; 19 background: white;
19 background: -webkit-linear-gradient(-90deg, #379AC7, #0460D9); 20 height: 50px;
20 background: linear-gradient(180deg, #379AC7, #0460D9); 21 }
21 height: 80px; 22
22 padding: 11px 0; 23 .brand-style
24 {
25 font-family: 'Ubuntu', sans-serif !important;
26 color:#00b395;
23 } 27 }
24 .logo img{ 28
25 width:170px;
26 }
27 .congo-wrap .header .container { 29 .congo-wrap .header .container {
28 width: 100%; 30 width: 100%;
29 padding:0 20px;
30 } 31 }
31 .congo-wrap{ 32 .congo-wrap{
32 background:#f6f7f7; 33 background:#00b395;
33 height:100%; 34 height:100%;
34 } 35 }
35 .widgetbox-congrats { 36 .widgetbox-congrats {
36 max-width: 720px; 37 margin: 20px auto;
37 margin: 0px auto; 38 width: 400px;
38 background: #fff; 39 height: auto;
39 position: relative; 40 padding: 20px;
40 top: 20px; 41 -webkit-border-radius: 8px/7px;
41 text-align: center; 42 -moz-border-radius: 8px/7px;
42 border: 1px solid #eee; 43 border-radius: 8px/7px;
43 font-size: 20px; 44 background-color: white;
45 -webkit-box-shadow: 1px 2px 5px rgba(0,0,0,.31);
46 -moz-box-shadow: 1px 2px 5px rgba(0,0,0,.31);
47 box-shadow: 1px 2px 5px rgba(0,0,0,.31);
48 border: solid 1px #cbc9c9;
49 font-family: 'Ubuntu', sans-serif;
44 } 50 }
45 51
46 body { 52 body {
47 margin: 0; 53 margin: 0;
48 padding: 0; 54 padding: 0;
49 } 55 }
50 56
51 .widgetbox-congrats .congo-msg {
52 padding: 90px 0;
53 border-bottom: 1px solid #eee;
54 }
55
56 .widgetbox-congrats.congo-msg h4 {margin: 0 !important;padding: 0 !important;}
57 57
58 .text-blue { 58 .text-blue {
59 color: #0059ce; 59 color: #00b395;
60 } 60 }
61 61
62 .widgetbox-congrats .congo-msg h4 { 62 .widgetbox-congrats .congo-msg h4 {
63 margin: 8px 0; 63 margin: 8px 0;
64 font-size: 24px; 64 font-size: 24px;
65 text-align:center;
65 } 66 }
66 67
67 .widgetbox-congrats .congo-msg .icon { 68 .widgetbox-congrats .congo-msg .icon {
68 color: #0F67C8; 69 color: #00b395;
69 font-size: 90px; 70 font-size: 90px;
70 font-weight: 100; 71 display: inline-block;
71 margin-bottom: 20px; 72 width: 100%;
72 display: block; 73 text-align: center;
73 } 74 }
74 75
75 .widgetbox-congrats .widgetbox-footer { 76 p
76 padding: 31px 10px; 77 {
78 display: inline-block;
79 width: 100%;
80 text-align: center;
77 } 81 }
78 82
79 .widgetbox-congrats .widgetbox-footer .btn { 83 .widgetbox-congrats .widgetbox-footer .btn {
80 background: #0e89d3; 84 background: #00b395;
81 color: #fff; 85 color: #fff;
82 padding: 10px 30px;
83 text-transform: uppercase; 86 text-transform: uppercase;
87 display: inline-block;
88 width: 100%;
89 text-align: center;
90 font-family: 'Ubuntu', sans-serif;s
84 } 91 }
85 </style> 92 </style>
86 93
87 </head> 94 </head>
88 95
89 <body> 96 <body>
90 <div class="congo-wrap"> 97 <div class="congo-wrap">
91 <div class="header"> 98 <div class="header">
92 <div class="container"> 99 <div class="container">
93 <div class="logo"> 100 <span class="brand-style">YOUNGDESK</span>
94 <img src="/files/images/svg/logo--white.svg" altt=""/>
95 </div>
96 </div> 101 </div>
97 </div> 102 </div>
98 <div class="container"> 103 <div class="container">
99 <div class="widgetbox-congrats"> 104 <div class="widgetbox-congrats">
100 <div class="congo-msg"> 105 <div class="congo-msg">
101 <div class="text-blue"> 106 <div class="text-blue">
102 <i class="icon icon-simple icon-check"></i> 107 <i class="icon icon-simple icon-check"></i>
103 <h4>Congrats!</h4> 108 <h4>Congrats!</h4>
104 </div> 109 </div>
105 <p> ${message}</p> 110 <p> ${message}</p>
106 </div> 111 </div>
107 <div class="widgetbox-footer"> 112 <div class="widgetbox-footer">
108 <a href="${redirect}" class="btn btn-lg btn-prmary">Continue</a> 113 <a href="${redirect}" class="btn btn-md btn-prmary">Continue</a>
109 </div> 114 </div>
110 115
111 </div> 116 </div>
112 </div> 117 </div>
113 </div> 118 </div>
114 119
115 </html> 120 </html>
116 `; 121 `;
117 122
118 res.writeHead(200, { 123 res.writeHead(200, {
119 'Content-Length': output.length, 124 'Content-Length': output.length,
120 'Content-Type': 'text/html', 125 'Content-Type': 'text/html',
121 }); 126 });
122 res.end(output); 127 res.end(output);
123 }; 128 };
124 129
125
126
127 Picker.route('/back/verifyEmail/:token', function(params, req, res, next) { 130 Picker.route('/back/verifyEmail/:token', function(params, req, res, next) {
128 131
129 const user = Users.findOne({'services.email.verificationTokens.token': params.token}); 132 const user = Users.findOne({'services.email.verificationTokens.token': params.token});
130 if(!user) return finishWithMessage(res, 'Invalid or outdated token.'); 133 if(!user) return finishWithMessage(res, 'Invalid or outdated token.');
131 134
132 const token = _.find(user.services.email.verificationTokens, x => x.token === params.token); 135 const token = _.find(user.services.email.verificationTokens, x => x.token === params.token);
133 if(new Date().getTime() - token.when.getTime() > 2 * 24 * 60 * 60 * 1000) return finishWithMessage(res, 'Invalid or outdated token.'); 136 if(new Date().getTime() - token.when.getTime() > 2 * 24 * 60 * 60 * 1000) return finishWithMessage(res, 'Invalid or outdated token.');
134 137
135 finishWithMessage(res, 'Email has been verified.',"/"); 138 finishWithMessage(res, 'Email has been verified.',"/");
136 const idx = _.findIndex(user.emails, x => x.address === token.address); 139 const idx = _.findIndex(user.emails, x => x.address === token.address);
137 140
138 Users.update({_id: user._id}, {$set: { 141 Users.update({_id: user._id}, {$set: {
139 [`emails.${idx}.verified`]: true, 142 [`emails.${idx}.verified`]: true,
140 }}); 143 }});
141 144
142
143
144
145 // "services": {
146 // "password": {
147 // "bcrypt": "$2a$10$FqOvMve/MonERrLIOCJbruvS9iHoz5ixknGfm/ZAiOt9EiF43W4Z6"
148 // },