Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ramostear committed Nov 26, 2019
1 parent a20aa1c commit d376eb5
Show file tree
Hide file tree
Showing 19 changed files with 272 additions and 19 deletions.
5 changes: 3 additions & 2 deletions db/una_boot_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
SQLyog v10.2
MySQL - 5.6.45-log : Database - una-boot-db
*********************************************************************
*/
*/


/*!40101 SET NAMES utf8 */;

Expand Down Expand Up @@ -38,7 +39,7 @@ CREATE TABLE `categories` (

/*Data for the table `categories` */

insert into `categories`(`id`,`create_time`,`deleted`,`update_time`,`allow_nav`,`description`,`keywords`,`name`,`parent_id`,`slug`,`sort_num`,`template`) values (1,'2019-11-19 07:33:46',0,'2019-11-19 07:41:30',0,'谭朝红的博客','谭朝红,博客,Spring,Spring Boot,Spring Cloud','首页',0,'index',1,'index.html'),(2,'2019-11-19 07:37:38',0,'2019-11-19 07:37:38',1,'项目','项目','项目',0,'projects',2,'projects.html'),(3,'2019-11-19 07:38:23',0,'2019-11-19 07:38:23',1,'指南','指南','指南',0,'guides',3,'guides.html'),(4,'2019-11-19 07:39:02',0,'2019-11-19 07:39:02',1,'博客','博客','博客',0,'blogs',4,'blogs.html'),(5,'2019-11-19 07:40:43',0,'2019-11-19 07:40:43',1,'关于我','关于我','关于我',0,'about',5,'about.html');
insert into `categories`(`id`,`create_time`,`deleted`,`update_time`,`allow_nav`,`description`,`keywords`,`name`,`parent_id`,`slug`,`sort_num`,`template`) values (1,'2019-11-19 07:33:46',0,'2019-11-19 07:41:30',0,'谭朝红的博客','谭朝红,博客,Spring,Spring Boot,Spring Cloud','首页',0,'index',1,'profile.html'),(2,'2019-11-19 07:37:38',0,'2019-11-19 07:37:38',1,'项目','项目','项目',0,'projects',2,'projects.html'),(3,'2019-11-19 07:38:23',0,'2019-11-19 07:38:23',1,'指南','指南','指南',0,'guides',3,'guides.html'),(4,'2019-11-19 07:39:02',0,'2019-11-19 07:39:02',1,'博客','博客','博客',0,'blogs',4,'blogs.html'),(5,'2019-11-19 07:40:43',0,'2019-11-19 07:40:43',1,'关于我','关于我','关于我',0,'about',5,'about.html');

/*Table structure for table `links` */

Expand Down
44 changes: 44 additions & 0 deletions src/main/java/com/ramostear/unaboot/web/admin/UserController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.ramostear.unaboot.web.admin;

import com.ramostear.unaboot.common.exception.UnaException;
import com.ramostear.unaboot.service.UserService;
import com.ramostear.unaboot.web.UnaController;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
* Created by Ramostear on 2019/11/26 0026.
*/
@Controller
@RequestMapping("/admin/user")
@RequiresUser
public class UserController extends UnaController {


@Autowired
private UserService userService;


@GetMapping("/profile")
public String profile(){
return "/admin/user/profile";
}

@PostMapping("/{userId}/password")
@ResponseBody
public ResponseEntity<Object> updatePassword(@PathVariable("userId")Integer userId,
@RequestParam(name = "oldPassword")String oldPassword,
@RequestParam(name = "newPassword")String newPassword){
try {
userService.updatePassword(userId,oldPassword,newPassword);
SecurityUtils.getSubject().logout();
return ok();
}catch (UnaException ex){
return badRequest();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ public AccountRealm accountRealm(){
accountRealm.setCredentialsMatcher(hashedCredentialsMatcher());
accountRealm.setCachingEnabled(true);
accountRealm.setCacheManager(ehCacheManager());
accountRealm.setAuthenticationCachingEnabled(true);
accountRealm.setAuthenticationCacheName("authenticationCache");
accountRealm.setAuthorizationCachingEnabled(true);
accountRealm.setAuthorizationCacheName("authorizationCache");
return accountRealm;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/static/js/ace/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -16366,16 +16366,16 @@ var Text = function(parentEl) {
if (!self.showInvisibles && simpleSpace)
continue;

var before = i != m.index ? value.slice(i, m.index) : "";
var before = i != m.profile ? value.slice(i, m.profile) : "";

i = m.index + m[0].length;
i = m.profile + m[0].length;

if (before) {
valueFragment.appendChild(this.dom.createTextNode(before, this.element));
}

if (tab) {
var tabSize = self.session.getScreenTabSize(screenColumn + m.index);
var tabSize = self.session.getScreenTabSize(screenColumn + m.profile);
valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(true));
screenColumn += tabSize - 1;
} else if (simpleSpace) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/layer/layer.js

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion src/main/resources/templates/admin/category/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,20 @@
resize:false,
anim:2,
});
})
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});
</script>
</html>
7 changes: 4 additions & 3 deletions src/main/resources/templates/admin/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ <h3 class="box-title">最新评论</h3>
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 管理员信息</i>",
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['50%','70%'],
content:"${una}/admin/profile",
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
Expand Down
15 changes: 14 additions & 1 deletion src/main/resources/templates/admin/link/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,20 @@
}
});
});
})
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});
</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/post/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,18 @@ <h3 class="box-title">文章属性</h3>
}
});
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/post/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,18 @@
})
});
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/post/write.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,18 @@ <h3 class="box-title">文章属性</h3>
}
})
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/setting/cache.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,18 @@
});
});
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
</script>
</html>
14 changes: 14 additions & 0 deletions src/main/resources/templates/admin/setting/cdn.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,20 @@
});
})
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});

</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/setting/general.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,19 @@
});
})
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});
function selectFile(element,fieldName){
try{
Expand Down
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/setting/talk.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@
});
})
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});
</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/theme/folders.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@
return false;
});
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});
</script>
</html>
13 changes: 13 additions & 0 deletions src/main/resources/templates/admin/theme/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@
})
});
});
$("#profile").on("click",function(){
layer.open({
type:2,
title:"<i class='fa fa-users'> 重置管理员密码</i>",
shadeClose:false,
shade:0.5,
area:['400px','350px'],
offset:['150px'],
content:"${una}/admin/user/profile",
resize:false,
anim:2,
});
});
});
</script>
</html>
65 changes: 65 additions & 0 deletions src/main/resources/templates/admin/user/profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tags</title>
<link rel="stylesheet" href="${una}/css/bootstrap.css" />
<link rel="stylesheet" href="${una}/css/font-awesome.css" />
<link rel="stylesheet" href="${una}/css/ionicons.css" />
<link rel="stylesheet" href="${una}/js/layer/theme/default/layer.css"/>
<link rel="stylesheet" href="${una}/css/blog-boot.css" />
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-12 p-0">
<form class="profile-form mt-4">
<div class="form-group form-inline">
<span class="col-3 text-right">登录名:</span>
<input class="form-control col-8" value="${profile.username}" readonly="readonly"/>
</div>
<div class="form-group form-inline">
<span class="col-3 text-right">旧密码:</span>
<input class="form-control col-8" name="oldPassword" type="password"/>
</div>
<div class="form-group form-inline">
<span class="col-3 text-right">新密码:</span>
<input class="form-control col-8" name="newPassword" type="password"/>
</div>
</form>
<div class="text-center">
<button type="button" class="btn btn-primary mt-4 ok-btn">确定</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="${una}/js/jquery.min.js" ></script>
<script type="text/javascript" src="${una}/js/bootstrap.min.js" ></script>
<script type="text/javascript" src="${una}/js/bootstrap.bundle.js" ></script>
<script type="text/javascript" src="${una}/js/layer/layer.js"></script>
<script type="text/javascript">
$(".ok-btn").on("click",function(){
var oldPassword = $("input[name=oldPassword]").val();
var newPassword = $("input[name=newPassword]").val();
if(oldPassword != null && oldPassword.trim()!="" && newPassword!=null && newPassword.trim()!=""){
$.ajax({
type:'POST',
url:'${una}/admin/user/${profile.id}/password',
data:{
oldPassword:oldPassword,
newPassword:newPassword
},
success:function(){
parent.location.reload();
},
error:function(){
layer.alert("服务器异常",{title:'系统提示',icon:0})
}
});
}else{
return;
}
});
</script>
</body>
</html>
Loading

0 comments on commit d376eb5

Please sign in to comment.