summaryrefslogtreecommitdiff
path: root/lib/login.js
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2015-08-07 00:51:23 +0100
committerprzemyslawpluta <przemekpluta@hotmail.com>2015-08-07 00:51:23 +0100
commit21cc55dfcccc3bb61512e73f131c07912c82cf85 (patch)
treeeefa0f00e663e912e3e26ddeea67459c30ad7ee9 /lib/login.js
parent26d1a1af0a7ad4d8fef24be22bd579ed292fc2f3 (diff)
downloadmongo-edu-21cc55dfcccc3bb61512e73f131c07912c82cf85.zip
check for not registered user
Diffstat (limited to 'lib/login.js')
-rw-r--r--lib/login.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/login.js b/lib/login.js
index 4715bc3..8091168 100644
--- a/lib/login.js
+++ b/lib/login.js
@@ -94,14 +94,16 @@ module.exports = {
request({ url: url + '/dashboard', jar: jar }, function get(err, res, body) {
if (err !== null) { return callback(err, null); }
+
bar.tick();
+
if (res.statusCode === 200) {
var list = [], $ = cheerio.load(body),
-
current = $('section.my-courses-courses').children(),
-
- link = $(current).filter('.media').children().find('h3').children();
+ link = $(current).filter('.media').children().find('h3').children(),
+ noCourses = $('section[class="empty-dashboard-message"]').text(),
+ findNewCourses = $('section[class="empty-dashboard-message"] a').attr('href');
bar.tick();
@@ -111,6 +113,8 @@ module.exports = {
bar.tick();
+ if (noCourses) { currentProfile.noCourses = noCourses.trim().split('\n').map(function items(item) { return item.replace(/ +/g, ' '); }).join('') + ' at ' + url + findNewCourses + '.\n'; }
+
callback(null, list, currentProfile);
}