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

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

阅读目录

* [今日进展](#1) * [问题困难](#2) * [明日任务](#3) * [今日贡献量](#4) * [站立式会议](#5) * [TODOlist](#6)

【今日进展】

  • 完成登录类代码
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) { }
    }
}

【问题困难】

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

【明日任务】

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

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

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

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

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

【今日贡献量】

韩啸 夏云霄 陈思兵 朱文远 张家佳
3 2.5 3 3.5 3

【站立式会议】

(上帝视角)

【TODOlist】

posted @ 2018-06-11 22:21  Java红茶  阅读(144)  评论(0编辑  收藏  举报