【Alpha版本】冲刺阶段——Day5

【Alpha版本】冲刺阶段——Day5

阅读目录

【今日进展】

  • 完成登录类代码
public void LOGIN() {
        con = GetDBConnection.connectDB("mysql","root","");

        if(con == null ) return;
        String select=" username Like '"+name+"'";
        String sqlStr ="select * from javablacktea where "+select;
        try {
            sql=con.createStatement();
            rs = sql.executeQuery(sqlStr);
            if(rs.next()) {
                salt=rs.getString(3);
                //System.out.println(salt);
                String cipherInTheInformation=rs.getString(2);
                //System.out.println(cipherInTheInformation);
                encrypt.setSalt(salt);
                this.cipher=encrypt.getpassword(cipher);
                //System.out.println(cipher);
                if(!cipherInTheInformation.equals(cipher)){
                    System.out.println("用户名或者密码错误!");
                }
                else{
                    System.out.println("登陆成功!");
                }
            }
            else{
                System.out.println("用户名或者密码错误!");
            }
            con.close();
        }
        catch(SQLException e) { }
    }
  • 完成修改密码模块代码
 public void MODIFY() {
        con = GetDBConnection.connectDB("mysql","root","");

        if(con == null ) return;
        String select=" username Like '"+name+"'";
        String sqlStr ="select * from javablacktea where "+select;
        try {
            sql=con.createStatement();
            rs = sql.executeQuery(sqlStr);
            if(rs.next()) {
                salt=rs.getString(3);
                //System.out.println(salt);
                String cipherInTheInformation=rs.getString(2);
                //System.out.println(cipherInTheInformation);
                encrypt.setSalt(salt);
                this.cipher=encrypt.getpassword(cipher);
                //System.out.println(cipher);
                if(!cipherInTheInformation.equals(cipher)){
                    System.out.println("用户名或者密码错误!");
                    //如果两次输入的密码不一致,那么就提醒错误。但是不明确提示是哪个错误。
                }
                else{
                    if(!newCipher1.equals(newCipher2)){
                        System.out.println("两次输入的新密码不一致!");
                    }
                    else{
                        salt=encrypt.getsalt();
                        cipher=encrypt.getpassword(newCipher1);
                        try {
                            String sqlStr2 ="update javablacktea set hash = "+"'"+cipher+"'"+"where username = "+"'"+name+"'";
                            String sqlStr3 ="update javablacktea set salt = "+"'"+salt+"'"+"where username = "+"'"+name+"'";

                            sql.executeUpdate(sqlStr2);
                            sql.executeUpdate(sqlStr3);
                            System.out.println("更改密码成功。");
                        }
                        catch (SQLException e){
                            System.out.println("更改密码失败。");
                        }
                    }
                }
            }
            else{
                System.out.println("用户名或者密码错误!");
                //如果两次输入的账号不一致,那么就提醒错误。但是不明确提示是哪个错误。
            }
            con.close();
        }
        catch(SQLException e) { }
    }
}
  • 完成注销类代码
public void CANCEL() {
        con = GetDBConnection.connectDB("mysql","root","");

        if(con == null ) return;
        String select=" username Like '"+name+"'";
        String sqlStr ="select * from javablacktea where "+select;
        try {
            sql=con.createStatement();
            rs = sql.executeQuery(sqlStr);
            if(rs.next()) {
                salt=rs.getString(3);
                //System.out.println(salt);
                String cipherInTheInformation=rs.getString(2);
                //System.out.println(cipherInTheInformation);
                encrypt.setSalt(salt);
                this.cipher=encrypt.getpassword(cipher);
                //System.out.println(cipher);
                if(!cipherInTheInformation.equals(cipher)){
                    System.out.println("用户名或者密码错误!");
                }
                else{
                    System.out.println("是否确定注销该账户?('Y'or'N')");
                    String flag = scanner.next();
                    ///接下来要删除数据库中的该项内容。
                    if(flag.equals("Y")){
                        try {
                            String sqlStr2 ="delete from javablacktea where username = "+"'"+name+"'";
                            sql.executeUpdate(sqlStr2);
                            System.out.println("注销成功。");
                        }
                        catch (SQLException e){
                            System.out.println("注销失败。");
                        }
                    }
                }
            }
            else{
                System.out.println("用户名或者密码错误!");
            }
            con.close();
        }
        catch(SQLException e) { }
    }
}

【问题困难】

  • 原先设想的是页面布局类代码可以直接调用现有程序实现前端界面,但深入学习后发现,想要实现组件功能需要大幅度改动现有的模块代码,任务量骤然增加。

【明日任务】

  • 韩啸: 完成注销用户模块页面设计

  • 夏云霄: 完成程序主页面设计

  • 陈思兵: 完成修改密码模块页面设计

  • 朱文远:完成登录模块页面设计

  • 张家佳:辅助其它队员完成任务,收集团队成员进展并且汇总,撰写博客

【今日贡献量】

韩啸夏云霄陈思兵朱文远张家佳
32.533.53

【站立式会议】

(上帝视角)

1394165-20180612021441055-740531992.jpg

【TODOlist】

1394165-20180613224453058-1331044028.png

转载于:https://www.cnblogs.com/javahc/p/9170308.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值