NutzCN Logo
问答 nutzsite中用户修改头像之后左侧导航栏头像无法更新,
发布于 1910天前 作者 qq_6c186ef5 1465 次浏览 复制 上一个帖子 下一个帖子
标签:

nutzsite中用户修改头像之后左侧导航栏头像无法更新,,点击左侧个人信息时头像是新修改的头像,但是导航位置显示默认头像,经调试发现user对象中有个image的对象为null;因此我在SimpleAuthorizingRealm中将doGetAuthenticationInfo方法简单的改了一下,希望下一个版本将这个问题更新一下:

7 回复

给他报个issue

修改前代码如下:

@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
		UsernamePasswordToken upToken = (UsernamePasswordToken) token;
		if (Lang.isEmpty(upToken) || Strings.isEmpty(upToken.getUsername())) {
			throw Lang.makeThrow(AuthenticationException.class, "Account name is empty");
		}
		User user = userService.fetch(Cnd.where("login_name","=",upToken.getUsername()));
		if (Lang.isEmpty(user)) {
			throw Lang.makeThrow(UnknownAccountException.class, "Account [ %s ] not found", upToken.getUsername());
		}
		if (user.isStatus()) {
			throw Lang.makeThrow(LockedAccountException.class, "Account [ %s ] is locked.", upToken.getUsername());
		}
		SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user,
				user.getPassword().toCharArray(), ByteSource.Util.bytes(user.getSalt()), getName());
		info.setCredentialsSalt(ByteSource.Util.bytes(user.getSalt()));
//        info.
		return info;
	}

修改后:我自己的代码中我简单改了一下,不知道修改的合理不,希望新版将这个问题处理一下:

@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
		UsernamePasswordToken upToken = (UsernamePasswordToken) token;
		if (Lang.isEmpty(upToken) || Strings.isEmpty(upToken.getUsername())) {
			throw Lang.makeThrow(AuthenticationException.class, "Account name is empty");
		}
		User user = userService.fetch(Cnd.where("login_name","=",upToken.getUsername()));
		if (Lang.isEmpty(user)) {
			throw Lang.makeThrow(UnknownAccountException.class, "Account [ %s ] not found", upToken.getUsername());
		}else{
			if(Lang.isEmpty(user.getImage())) {
				user = userService.fetchLinks(user, "image");
				if (Lang.isEmpty(user)) {
					throw Lang.makeThrow(UnknownAccountException.class, "Account [ %s ] not found", upToken.getUsername());
				}
			}
		}
		if (user.isStatus()) {
			throw Lang.makeThrow(LockedAccountException.class, "Account [ %s ] is locked.", upToken.getUsername());
		}
		SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user,
				user.getPassword().toCharArray(), ByteSource.Util.bytes(user.getSalt()), getName());
		info.setCredentialsSalt(ByteSource.Util.bytes(user.getSalt()));
//        info.
		return info;
	}

感谢 提醒 这个问题 我还没想好 如何处理

导出数据的功能还没开发完吗?

@Hamming(tonyyule)

系统管理->参数设置 有导出案例

项目成war包之后为什么发布到tomcat中启动解压的文件中引用的jar包都放到classes中了,没有已jar包的形式引入呢

添加回复
请先登陆
回到顶部