Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
lifei6671 committed Feb 5, 2018
1 parent 7e98f2c commit 0655705
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 39 deletions.
1 change: 1 addition & 0 deletions controllers/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func (c *AccountController) FindPassword() {
data := map[string]interface{}{
"SITE_NAME": c.Option["SITE_NAME"],
"url": c.BaseUrl() + beego.URLFor("AccountController.FindPassword", "token", member_token.Token, "mail", email),
"BaseUrl": c.BaseUrl(),
}

body, err := c.ExecuteViewPathTemplate("account/mail_template.tpl", data)
Expand Down
14 changes: 11 additions & 3 deletions mail/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"regexp"
"strconv"
"strings"
"github.com/astaxie/beego"
)

var (
Expand Down Expand Up @@ -85,8 +86,8 @@ func (s *SMTPConfig) Auth() smtp.Auth {
case "SSL":
fallthrough
default:
auth = smtp.PlainAuth(s.Identity, s.Username, s.Password, s.Host)
//auth = unencryptedAuth{smtp.PlainAuth(s.Identity, s.Username, s.Password, s.Host)}
//auth = smtp.PlainAuth(s.Identity, s.Username, s.Password, s.Host)
auth = unencryptedAuth{smtp.PlainAuth(s.Identity, s.Username, s.Password, s.Host)}
}
return auth
}
Expand Down Expand Up @@ -234,13 +235,20 @@ func (c *SMTPClient) SendTLS(m Mail, message bytes.Buffer) error {
log.Println(err)
return err
}

//if err := ct.StartTLS(tlsconfig);err != nil {
// log.Println("StartTLS Error:",err,c.host,c.port)
// return err
//}

//if err := ct.StartTLS(tlsconfig);err != nil {
// fmt.Println(err)
// return err
//}

fmt.Println(c.smtpAuth)
if ok,_ := ct.Extension("AUTH"); ok {
if ok,s := ct.Extension("AUTH"); ok {
beego.Info(s)
// Auth
if err = ct.Auth(c.smtpAuth); err != nil {
log.Println("Auth Error:",
Expand Down
6 changes: 3 additions & 3 deletions views/account/find_password_setp1.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="favicon.ico">
<link rel="shortcut icon" href="/favicon.ico">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -12,7 +12,7 @@
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand All @@ -26,7 +26,7 @@
<header class="navbar navbar-static-top smart-nav navbar-fixed-top manual-header" role="banner">
<div class="container">
<div class="navbar-header col-sm-12 col-md-6 col-lg-5">
<a href="/" class="navbar-brand">{{.SITE_NAME}}</a>
<a href="{{.BaseUrl}}" class="navbar-brand">{{.SITE_NAME}}</a>
</div>
</div>
</header>
Expand Down
10 changes: 5 additions & 5 deletions views/account/find_password_setp2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand All @@ -26,7 +26,7 @@
<header class="navbar navbar-static-top smart-nav navbar-fixed-top manual-header" role="banner">
<div class="container">
<div class="navbar-header col-sm-12 col-md-6 col-lg-5">
<a href="/" class="navbar-brand">{{.SITE_NAME}}</a>
<a href="{{.BaseUrl}}" class="navbar-brand">{{.SITE_NAME}}</a>
</div>
</div>
</header>
Expand Down Expand Up @@ -67,9 +67,9 @@
</div>
{{template "widgets/footer.tpl" .}}
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/static/layer/layer.js" type="text/javascript"></script>
<script src="/static/js/jquery.form.js" type="text/javascript"></script>
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/layer/layer.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#email,#code").on('focus',function () {
Expand Down
4 changes: 2 additions & 2 deletions views/account/login.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand All @@ -26,7 +26,7 @@
<header class="navbar navbar-static-top smart-nav navbar-fixed-top manual-header" role="banner">
<div class="container">
<div class="navbar-header col-sm-12 col-md-6 col-lg-5">
<a href="/" class="navbar-brand">{{.SITE_NAME}}</a>
<a href="{{.BaseUrl}}" class="navbar-brand">{{.SITE_NAME}}</a>
</div>
</div>
</header>
Expand Down
5 changes: 2 additions & 3 deletions views/account/mail_template.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="SmartWiki" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>找回密码 - Powered by MinDoc</title>
<style type="text/css">
Expand Down Expand Up @@ -67,7 +66,7 @@
<div>
<div class="wrapper" style="margin: 20px auto 0; width: 500px; padding-top:16px; padding-bottom:10px;">
<div class="header clearfix">
<a class="logo" href="https://www.iminho.me/" target="_blank"><b>{{.SITE_NAME}}</b></a>
<a class="logo" href="{{.BaseUrl}}" target="_blank"><b>{{.SITE_NAME}}</b></a>
</div>
<br style="clear:both; height:0">
<div class="content" style="background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #E9E9E9; margin: 2px 0 0; padding: 30px;">
Expand All @@ -89,7 +88,7 @@
</p>
<p class="footer" style="border-top: 1px solid #DDDDDD; padding-top:6px; margin-top:25px; color:#838383;">
请勿回复本邮件, 此邮箱未受监控, 您不会得到任何回复. 要获得帮助, 请登录网站<br><br>
<a href="https://www.iminho.me/" target="_blank">MinDoc</a>
<a href="{{.BaseUrl}}" target="_blank">{{.SITE_NAME}}</a>
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/book/dashboard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
<script src="{{cdnjs "/static/layer/layer.js"}}"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#btnRelease").on("click",function () {
Expand Down
2 changes: 1 addition & 1 deletion views/book/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/vuejs/vue.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#addBookDialogForm").ajaxForm({
Expand Down
2 changes: 1 addition & 1 deletion views/book/setting.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/bootstrap/plugins/tagsinput/bootstrap-tagsinput.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/bootstrap/plugins/bootstrap-switch/js/bootstrap-switch.min.js"}}" type="text/javascript"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#upload-logo-panel").on("hidden.bs.modal",function () {
Expand Down
4 changes: 2 additions & 2 deletions views/book/users.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
<script src="{{cdnjs "/static/vuejs/vue.min.js"}}"></script>
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script src="/static/select2/4.0.5/js/select2.full.min.js"></script>
<script src="/static/select2/4.0.5/js/i18n/zh-CN.js"></script>
<script src="{{cdnjs "/static/select2/4.0.5/js/select2.full.min.js"}}"></script>
<script src="{{cdnjs "/static/select2/4.0.5/js/i18n/zh-CN.js"}}"></script>
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
Expand Down
2 changes: 1 addition & 1 deletion views/document/compare.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</div>
<template id="historyContent">{{.HistoryContent}}</template>
<template id="documentContent">{{.Content}}</template>
<script type="text/javascript" src="/static/layer/layer.js"></script>
<script type="text/javascript" src="{{cdnjs "/static/layer/layer.js"}}"></script>

</body>
</html>
2 changes: 1 addition & 1 deletion views/errors/403.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>权限不足 - Powered by MinDoc</title>
<link href="/static/fonts/lato-100.css" rel="stylesheet" type="text/css">
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
<style type="text/css">
html, body {
height: 100%;
Expand Down
2 changes: 1 addition & 1 deletion views/errors/404.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>页面不存在 - Powered by MinDoc</title>
<link href="/static/fonts/lato-100.css" rel="stylesheet" type="text/css">
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
<style type="text/css">
html, body {
height: 100%;
Expand Down
2 changes: 1 addition & 1 deletion views/errors/error.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>服务器异常 - Powered by MinDoc</title>
<link href="/static/fonts/lato-100.css" rel="stylesheet" type="text/css">
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
<style type="text/css">
html, body {
height: 100%;
Expand Down
2 changes: 1 addition & 1 deletion views/manager/attach_detailed.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet" type="text/css">

<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion views/manager/edit_book.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/webuploader/webuploader.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/cropper/2.3.4/cropper.min.css"}}" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down
4 changes: 2 additions & 2 deletions views/manager/edit_users.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down Expand Up @@ -90,7 +90,7 @@
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#saveMemberInfoForm").ajaxForm({
Expand Down
2 changes: 1 addition & 1 deletion views/manager/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">

<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down
4 changes: 2 additions & 2 deletions views/manager/setting.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down Expand Up @@ -114,7 +114,7 @@
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#gloablEditForm").ajaxForm({
Expand Down
10 changes: 5 additions & 5 deletions views/manager/users.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@
</form>
</div>
</div><!--END Modal-->
<script src="/static/jquery/1.12.4/jquery.min.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/vuejs/vue.min.js"></script>
<script src="/static/js/jquery.form.js" type="text/javascript"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script src="{{cdncss "/static/jquery/1.12.4/jquery.min.js"}}"></script>
<script src="{{cdncss "/static/bootstrap/js/bootstrap.min.js"}}"></script>
<script src="{{cdncss "/static/vuejs/vue.min.js"}}"></script>
<script src="{{cdncss "/static/js/jquery.form.js"}}" type="text/javascript"></script>
<script src="{{cdncss "/static/js/main.js"}}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#addMemberDialogModal").on("show.bs.modal",function () {
Expand Down
2 changes: 1 addition & 1 deletion views/search/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">

<link href="/static/css/main.css" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion views/setting/password.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">

<link href="/{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down

0 comments on commit 0655705

Please sign in to comment.