Loggin信息用户名或用户ID [英] Loggin infformation username or user id

查看:73
本文介绍了Loggin信息用户名或用户ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过动态元节点保持登录信息用户



我尝试过:



hi

i使用c#创建winform(数据库sql server)

i登录表单没有问题

但我想使用用户名和更改密码表单中的用户ID或...

但我不使用传统方法,例如用户保存在labale或设置应用程序

请帮助我

keep login information user by dynamic metode

What I have tried:

hi
i create winform with c#(data base sql server)
i dont problem with login form
but i want use username and user id in change password form or ...
but i do not I use traditional methods like user save in labale or setting application
please help me

推荐答案

通常,用户不知道 - 或关心 - 他们的UserId:这是一个唯一标识用户的内部标签,即使他在以后更改了他的名字。这就是为什么它可以是数字或Guid - 用户不需要知道它。



应用程序或网站的通常过程很简单:

1)用户使用他的用户名和密码登录。

2)您的软件根据您使用用户名存储的哈希密码验证密码,如果哈希值匹配从数据库中获取UserID。

3)您的软件临时存储UserID(即在您的应用程序生命周期内,或直到用户注销,以先到者为准 - 这是非持久性存储)。这可以是网站的会话或Cookie,也可以是普通应用的静态变量。

4)然后,您可以使用UserID识别用户,当您获取用户名时我想把它显示给他。



所以更改你的密码表单会接受旧密码和新密码(新密码经常输入两次)会对它们进行哈希处理如果旧散列与您在上面步骤(3)中存储的UserID的DB行匹配,则仅更新数据库中的用户记录。
Generally, the user does not know - or care about - their UserId: that's an internal "tag" that uniquely identifies the user, even if he changes his name at a later date. That's why it can be a number, or a Guid - the user doesn't need to know it.

The usual process for a app or website is simple:
1) The user logs in, using his username and password.
2) Your software validates the password against a hashed password you store with the Username, and if the hashes match, fetches the UserID from the DB.
3) Your software stores the UserID temporarily (i.e. for the life of you app, or until the user logs out, whichever comes first - this is non-persistent storage). This can be in the Session or Cookie for a web site, or just a static variable for a "normal" app.
4) You then use the UserID to identify the user, fetching his username when you want to display it back to him.

So a "change your password" form accepts the old and new passwords (which the new one entered twice quite often) hashes them both, and only updates the User record in the DB if the old hash matches the DB row for the UserID that you stored in step (3) above.


mean static field ??



注销应该是什么?
mean static field??

What should for log out؟؟


这篇关于Loggin信息用户名或用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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