CPress 用户注册登录相关 API

创建验证码

curl -XPOST http://127.0.0.1:8080/api/captcha/create

成功返回:{"code":"SUCCESS","message":null,"data":{"captchaKey":"foo"}}


验证码图片

http://127.0.0.1:8080/api/captcha/show?captchaKey=foo


发送手机短信 (需要到管理后台 → 系统配置 → 设置 填写阿里云短信相关参数)

curl -XPOST http://127.0.0.1:8080/api/sms/send -d "mobile=18812345678&captchaCode=xxx&captchaKey=foo"

成功返回:{"code":"SUCCESS","message":null,"data":{"verificationKey":"bar"}}


用户注册

curl -XPOST http://127.0.0.1:8080/api/user/register -d "mobile=18812345678&verificationCode=xxxx&name=jack&password=123456&verificationKey=bar"

成功返回:{"code":"SUCCESS","message":null,"data":{"token":"baz"}}


帐号密码登录

curl -XPOST http://127.0.0.1:8080/api/user/login -d "account=18812345678&password=123456"

成功返回:{"code":"SUCCESS","message":null,"data":{"token":"xyxyxyxy"}}

 

手机短信登录

curl -XPOST http://127.0.0.1:8080/api/user/login -d "mobile=18812345678&verificationCode=xxx&verificationKey=bar"

成功返回:{"code":"SUCCESS","message":null,"data":{"token":"xyxyxyxy"}}


用户个人信息

curl http://127.0.0.1:8080/api/user/whoami?token=xyxyxyxy

成功返回:{"code":"SUCCESS","message":null,"data":{"id":"2","mobile":"188**5678","status":"normal"}}


手机短信重置密码

curl -XPOST http://127.0.0.1:8080/api/user/password/sms -d "mobile=18812345678&verificationCode=xxx&verificationKey=bar&newPassword=123456"

成功返回:{"code":"SUCCESS","message":null,"data":null}

 

修改密码

curl -s -XPOST http://127.0.0.1:8080/api/user/password?token=xyxyxyxy -d "oldPassword=123456&newPassword=111111"

成功返回:{"code":"SUCCESS","message":null,"data":null}