unissoft-bj / ihostsvc

system services & data services on ihost
0 stars 0 forks source link

用户登录 rest #25

Open unissoft-bj opened 9 years ago

unissoft-bj commented 9 years ago

前端发起登录尝试

提交参数:mac,cookie:mac-pwd,cookie:phone,cookie:account-pwd 返回参数:状态,account,mac,mac-pwd,phone,account-pwd

rest逻辑:见下个comment

前端处理: 1,错误,显示错误页面 2,成功,显示用户工作页面 3,需要account-pwd认证,显示手机号(预填充或者空)、密码页面(找回密码可暂不做) 4,其他,显示 请输入上网码 页面

unissoft-bj commented 9 years ago

REST接受参数 首先查ip所对应的mac地址

0,ihost无法确定mac地址

返回错误

1,只有mac地址参数: rest返回:

可识别的mac,对应到唯一的account,返回account的phone,所要求的认证模式mac-pwd or account-pwd 其他,无法确定account,用mac-pwd认证(新用户,新mac)(不可识别的mac,mac对应到多个account)

2,前端发给rest的有mac + mac-pwd: rest返回:

可识别的mac + mac-pwd,对应到唯一的account,返回account 可识别的mac + mac-pwd,对应到唯一的account,但account需要account-pwd认证,返回phone 可识别的mac,对应到唯一account,需要account-pwd认证,返回phone 可识别的mac,对应到唯一account,需要mac-pwd认证,返回phone 其他,无法确定account,按新用户,新mac处理(不可识别的mac,mac对应到多个account,或者mac + mac-pwd对应到多个account)

3,前端发给rest的有mac + phone: rest返回:

可识别的mac + phone,对应到唯一account,需要account-pwd认证,返回phone(老用户,老mac) 可识别的mac + phone,对应到唯一account,需要mac-pwd认证,返回phone(老用户,老mac) 可识别的phone,对应到唯一account,需要account-pwd认证,返回phone(老用户,新mac) 可识别的phone,对应到唯一account,需要mac-pwd认证,返回phone(老用户,新mac) 其他,无法确定account,用mac-pwd认证(新用户,新mac)

4,前端发给rest的有mac + mac-pwd + phone: rest返回:

可识别的mac + mac-pwd + phone,对应到唯一的account,此account允许mac-pwd认证,返回account 可识别的mac + mac-pwd + phone,对应到唯一的account,但account需要account-pwd认证,返回phone 可识别的mac + phone,对应到唯一account,需要account-pwd认证,返回phone 可识别的mac + phone,对应到唯一account,需要mac-pwd认证,返回phone 可识别的phone,对应到唯一account,需要account-pwd认证,返回phone(老用户,新mac) 可识别的phone,对应到唯一account,需要mac-pwd认证,返回phone(老用户,新mac) 其他,无法确定account,用mac-pwd认证(新用户,新mac)

5,前端发给rest的有mac + mac-pwd + phone + account-pwd: rest返回:

可识别的phone + account-pwd,返回account 可识别的mac + mac-pwd + phone,对应到唯一的account,此account允许mac-pwd认证,返回account 可识别的mac + mac-pwd + phone,对应到唯一的account,但account需要account-pwd认证,返回phone 可识别的mac + phone,对应到唯一account,需要account-pwd认证,返回phone 可识别的mac + phone,对应到唯一account,需要mac-pwd认证,返回phone 可识别的phone,对应到唯一account,需要account-pwd认证,返回phone(老用户,新mac) 可识别的phone,对应到唯一account,需要mac-pwd认证,返回phone(老用户,新mac) 其他,无法确定account,用mac-pwd认证(新用户,新mac)

6,前端发给rest的有mac + phone + account-pwd: rest返回:

可识别的phone + account-pwd,返回account 可识别的mac + phone,对应到唯一account,需要account-pwd认证,返回phone 可识别的mac + phone,对应到唯一account,需要mac-pwd认证,返回phone 可识别的phone,对应到唯一account,需要account-pwd认证,返回phone(老用户,新mac) 可识别的phone,对应到唯一account,需要mac-pwd认证,返回phone(老用户,新mac) 其他,无法确定account,用mac-pwd认证(新用户,新mac)

7,其他: rest返回:

其他,无法确定account,用mac-pwd认证(新用户,新mac)

参考:尝试登录过程 https://github.com/unissoft-bj/ihostsvc/issues/18

ycyn521 commented 9 years ago

aotuLogin()

return:int loginCode loginCode:-1-failed、2-success、3-需要account-pwd认证,显示手机号(预填充或者空)、4-其他(转到register逻辑)

getUserInfo() userInfo{.....userRole} userRole: -1-failed,0-普通用户,1-销售经理,2-销售顾问,3-客服

前台操作:登陆失败提示相应的信息; 登陆成功后先开通internet,然后根据userRole转到相应的页面

ycyn521 commented 9 years ago

post: /login form params: phone、account-pwd、mac, mac-pwd return:state: http status OK ==> login success, and open internet http status 401 ==> login fails. inspect returned json message: MSG_PHONE_PAGE = "{'login': 'FAILURE', 'code': 'PHONE_LOGIN'}"; MSG_TOKEN_PAGE = "{'login': 'FAILURE', 'code': 'TOKEN_LOGIN'}"; select next page based on the code value.

前端处理: 1,成功,显示用户工作页面 2,需要account-pwd认证,显示手机号(预填充或者空)、密码页面(找回密码可暂不做) 3,其他,显示 请输入上网码 页面 4,错误,显示错误页面

michaelyin commented 9 years ago

logout rest:

post /logout

user's internet access will be blocked.

michaelyin commented 9 years ago

class="form-control" id="username" name="username" ng-model="credentials.username"/>

<div class="form-group">
    <label for="password">phone:</label> <input type="tel"
        class="form-control" id="phone" name="phone" ng-model="credentials.phone"/>
</div>
<div class="form-group">
    <label for="password">phone password:</label> <input type="password"
        class="form-control" id="phone_pass" name="phone_pass" ng-model="credentials.phone_pass"/>
</div>