hezean / sustc

Template for project 2 of SUSTech Principles of Database Systems (CS307 / CS213), 23 fall semester.
http://172.18.34.154
MIT License
22 stars 9 forks source link

[AuthInfo] What result are the following 16 cases? #50

Closed LunaQu4kez closed 10 months ago

LunaQu4kez commented 10 months ago

Describe your question

There are 4 fields in AuthInfo, which are mid, password(pw for short), qq, wechat(wx for short). So there are 16 combinations of this 4 fields. Now I want to know for each combination, how can the user login in successfully. (In the following cases, 1 means have this field, 0 means this field is null or empty)

0mid, 0pw, 0qq, 0wx:

all don't have, can't login

0mid, 0pw, 0qq, 1wx:

if can find wx(the wx belongs to user A)
    login
else cannot find wx
    cannot login

0mid, 0pw, 1qq, 0wx:

if can find qq(the qq belongs to user A)
    login
else cannot find qq
    cannot login

0mid, 0pw, 1qq, 1wx:

if at least one of qq, wx cannot find
    cannot login
else 
    if wx and qq belongs to the same people, login; else, cannot login

0mid, 1pw, 0qq, 0wx:

only have password, cannot login

0mid, 1pw, 0qq, 1wx:

if wx cannot find
    cannot login
else wx can find (this wx belongs to user A)
    pw of user A is correct, login; else, cannot login

0mid, 1pw, 1qq, 0wx:

if qq cannot find
    cannot login
else qq can find (this qq belongs to user A)
    pw of user A is correct, login; else, cannot login

0mid, 1pw, 1qq, 1wx:

if at least one of qq, wx cannot find
    cannot login
else (qq and wx both can find)
    if qq and wx not belongs to the same user
        cannot login
    else (both belongs to user A)
        pw of user A is correct, login; else, cannot login

1mid, 0pw, 0qq, 0wx:

only have mid, cannot login

the other 7 cases

1mid, 0pw, 0qq, 1wx: 1mid, 0pw, 1qq, 0wx: 1mid, 0pw, 1qq, 1wx: 1mid, 1pw, 0qq, 0wx: 1mid, 1pw, 0qq, 1wx: 1mid, 1pw, 1qq, 0wx: 1mid, 1pw, 1qq, 1wx:

    if mid cannot find
        cannot login
    else (mid can find)
        all the other provided info should match this user's authentic info, otherwise cannot login

Thanks a lot!

WhatWEat commented 10 months ago

Can I directly modify your comment? It might make things clearer.

LunaQu4kez commented 10 months ago

Sorry, I'm not good at English. In Chinese, 如果4项信息都不提供,不能登陆。 如果只提供1项信息。只有mid或者只有密码,不能登陆。只有qq或只有微信的时候,只要有人的qq或微信是提供的这个,那这个人就登陆成功。 如果提供2项信息,这2项信息必须是同一个人的就能登陆,即使不提供mid,只要2项信息是同一个人的,就能登陆,否则不能。比如,没有mid和微信,只有密码和qq,根据qq识别出来这个人的身份,然后看密码对不对,对了就能登陆,不对就不能。 如果提供了3项或4项信息,只要提供的所有的都是同一个人的,就可以登陆,否则不能。 请问这样子理解是正确的吗

WhatWEat commented 10 months ago

对的,简单来说,就2个条件:

  1. qq,wecaht,mid和password三组登录方式,至少提供一种
  2. 所有提供的有效信息,必须是对的.
LunaQu4kez commented 10 months ago

明白了,非常感谢