• 大小: 2.88MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-02
  • 语言: 其他
  • 标签: ssm商城  

资源简介

一个简易的ssm商城系统,功能稍微简单,但是作为初学者,完全够了

资源截图

代码片段和文件信息

package ssm.com.zhang;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import ssm.com.zhang.sys.domain.Msg;

import javax.servlet.http.HttpServletRequest;

/**
 * 登录管理
 *
 * @Author brian.zhang
 * @Date : 7/24/2017 4:32 PM
 */
@Controller
public class LoginController {

    /**
     * 登录主界面
     *
     * @param []
     * @return java.lang.String
     * @author brian.zhang
     * @date 12/5/2017 17:13
     */
    @RequestMapping(“/login“)
    public String login() {
        return “login“;
    }

    /**
     * 登录
     *
     * @param [request]
     * @return java.lang.String
     * @author brian.zhang
     * @date 12/7/2017 16:44
     */
    @RequestMapping(“/index“)
    public String index(HttpServletRequest request) {
        System.out.println(request.getParameter(“userName“) + “:“ + request.getParameter(“password“));
        System.out.println(request.getParameter(“remember“));
        String userName = request.getParameter(“userName“);
        String password = request.getParameter(“password“);
        String rememberMe = request.getParameter(“rememberMe“);
        String msg = ““;
        Subject subject = SecurityUtils.getSubject();
        UsernamePasswordToken token = new UsernamePasswordToken(userName password);
        try {
            if (rememberMe != null && “1“.equals(rememberMe)) {
                token.setRememberMe(true);
            }
            subject.login(token);
            if (subject.isAuthenticated()) {
                return “index“;
            } else {
                return “login“;
            }
        } catch (IncorrectCredentialsException e) {
            msg = “登录密码错误. Password for account “ + token.getPrincipal() + “ was incorrect.“;
        } catch (ExcessiveAttemptsException e) {
            msg = “登录失败次数过多“;
        } catch (LockedAccountException e) {
            msg = “帐号已被锁定. The account for username “ + token.getPrincipal() + “ was locked.“;
        } catch (DisabledAccountException e) {
            msg = “帐号已被禁用. The account for username “ + token.getPrincipal() + “ was disabled.“;
        } catch (ExpiredCredentialsException e) {
            msg = “帐号已过期. the account for username “ + token.getPrincipal() + “  was expired.“;
        } catch (UnknownAccountException e) {
            msg = “帐号不存在. There is no user with username of “ + token.getPrincipal();
        } catch (UnauthorizedException e) {
            msg = “您没有得到相应的授权!“ + e.getMessage();
        } finally {
        }
        return “login“;
    }


    /**
     * 越权主界面
     *
     * @param []
     * @return java.lang.String
     * @author brian.zhang
     * @date 12/6/2017 16:16
     */
    @RequestMapping(“/unauthorized“)
    public String unauthorized

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-11 08:33  web-ssm-master\
     文件        7935  2017-12-11 08:33  web-ssm-master\pom.xml
     目录           0  2017-12-11 08:33  web-ssm-master\src\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\sql\
     文件       36154  2017-12-11 08:33  web-ssm-master\src\main\java\sql\ssm.sql
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\
     文件        3477  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\LoginController.java
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\common\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\common\realm\
     文件        3361  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\common\realm\UserRealm.java
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\
     文件        1384  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\OrganizationMapper.java
     文件        1686  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\ResourceMapper.java
     文件        1514  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\RoleMapper.java
     文件        1699  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\RoleSourceMapper.java
     文件        2036  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\UserMapper.java
     文件        1415  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\UserOrgMapper.java
     文件        1636  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\dao\UserRoleMapper.java
     目录           0  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\
     文件        1254  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\Msg.java
     文件        2822  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\Organization.java
     文件        2996  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\Resource.java
     文件        2130  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\Role.java
     文件         581  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\RoleSource.java
     文件        3532  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\User.java
     文件         543  2017-12-11 08:33  web-ssm-master\src\main\java\ssm\com\zhang\sys\domain\UserOrg.java
............此处省略439个文件信息

评论

共有 条评论