private void SendMail(User u, UserValidate uv) { string link = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Authority, UrlTo <UserController>(p => p.Active(uv.SerializeToString()))); string mail = string.Format("请点击以下链接或复制链接到浏览器里以完成用户注册:<br/>\n<a href=\"{0}\">{0}</a>", link); CommonHelper.SendMail(u.Email, mail); }
public void Profile() { var password = Bind("password"); var password1 = Bind("password1"); var password2 = Bind("password2"); if (!password.LikeNull()) { if (CommonHelper.GetHashedPassword(password) != this.GetLoginUser().Password) { Flash.Warning = "密码错误"; return; } if (password1.LikeNull() || password1 != password2) { Flash.Warning = "新密码为空或不匹配"; } if (password.Length >= 100) { return; } var u = this.GetLoginUser(); u.Password = password1; u.Save(); Flash.Notice = "密码修改成功"; } else { var showname = Bind("showname"); if (showname.LikeNull()) { Flash.Warning = "请填写您要修改的部分"; return; } var u = this.GetLoginUser(); u.ShowName = showname.Trim(); u.Save(); Flash.Notice = "用户名修改成功"; } }