Permalink
Browse files

active account without relogin, @todo: mail.js and sign.js refactor

  • Loading branch information...
hujinpu committed Apr 21, 2012
1 parent ebb79ba commit 2eb00542854fc2c9439d72bbc36c985005b131a9
Showing with 8 additions and 4 deletions.
  1. +3 −1 controllers/mail.js
  2. +5 −3 controllers/sign.js
View
@@ -82,9 +82,10 @@ function send_active_mail(who, token, name, email, cb) {
var sender = config.mail_sender;
var to = who;
var subject = config.name + '社区帐号激活';
+ var jump_url = config.host + ':' + config.port + '/active_account?key=' + token + '&name=' + name + '&email=' + email;
var html = '<p>您好:<p/>' +
'<p>我们收到您在' + config.name + '社区的注册信息,请点击下面的链接来激活帐户:</p>' +
- '<a href="' + config.host + '/active_account?key=' + token + '&name=' + name + '&email=' + email + '">激活链接</a>' +
+ '<a href="' + jump_url + '">激活链接</a>' +
'<p>若您没有在' + config.name + '社区填写过注册信息,说明有人滥用了您的电子邮箱,请删除此邮件,我们对给您造成的打扰感到抱歉。</p>' +
'<p>' +config.name +'社区 谨上。</p>'
@@ -97,6 +98,7 @@ function send_active_mail(who, token, name, email, cb) {
cb (null, true);
send_mail(data);
}
+
function send_reset_pass_mail(who, token, name, cb) {
var sender = config.mail_sender;
var to = who;
View
@@ -170,12 +170,14 @@ exports.active_account = function(req,res,next) {
return;
}
if(user.active){
- res.render('notify/notify',{error: '帐号已经是激活状态。'});
- return;
+ res.render('notify/notify',{error: '帐号已经是激活状态。'});
+ return;
}
user.active = true;
user.save(function(err){
- res.render('notify/notify',{success: '帐号已被激活,请登录'});
+ // store session cookie
+ gen_session(user, res);
+ res.redirect('home');
});
});
}

0 comments on commit 2eb0054

Please sign in to comment.