如何将确认字段添加到mysql表创建 [英] how to add confirmation fields to mysql table creation

查看:88
本文介绍了如何将确认字段添加到mysql表创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注有关如何使用android Studio应用程序的mysql制作表的教程 这是创建表的代码

I am following a tutorial on how to make table with mysql for android studio app this is the code to create table

create table users(
id int(11) primary key auto_increment,
unique_id varchar(23) not null unique,
name varchar(50) not null,
email varchar(100) not null unique,
encrypted_password varchar(80) not null,
salt varchar(10) not null,
created_at datetime,
updated_at datetime null
);

但是本教程中的表单仅具有:

but the form in this tutorial only has:

name
email
password

当我的表格有:

email
confirm email
name
password
confirm password
referral code

如何添加确认字段,例如,将密码字段确认到mysql create table

how do i add the confirmation fields,e.g confirm password fields to mysql create table

推荐答案

创建帐户时:

  1. 验证字段
  2. 指定密码和确认字段
  3. 根据使用的语言,通过密码派生功能(例如,password_hash/password_verifyPBKDF2Bcrypt)运行密码.
  4. 在数据库的密码字段中输入密码派生
  1. Validate the fields
  2. Comapre the password and confirmation fields
  3. Run the password through a password derivation function such as password_hash/password_verify, PBKDF2 or Bcrypt depending on the language you are using.
  4. Put the password derivation in the password field of the DB

登录时:

  1. 使用用户ID(名称?)从数据库中检索帐户信息

如果使用password_hash/password_verify

  1. 使用提供的密码和数据库中的密码值呼叫password_verify

其他

  1. 通过上面使用的密码派生功能运行密码
  2. 将派生的密码与数据库中的值进行比较

注意:请勿在数据库中添加confirm passwordconfirm email字段,只需使用它们来验证提交即可.

Note: Do not add a confirm password or confirm email field to the DB, just use them to verify the submission.

这篇关于如何将确认字段添加到mysql表创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆