-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Aris Supriyanto edited this page Jan 6, 2017
·
1 revision
You can create an account in the following way, send POST method to http://(HOST):(PORT)/beta/member/register :
{
"username":"USER_MEMBER",
"password":"USER_PASSWORS",
"email":"USER_EMAIL",
"name":"USER_NAME",
"phone":"PHONE_NUMBER"
}
registration function can be found in module member and then send to method registration, like this
from openedoo.module_member import module_member
load_json = json.loads(request.data)
username = load_json['username']
password = load_json['password']
email = load_json['email']
name = load_json['name']
phone = load_json['phone']
payload = module_member.registration(username,password,email,name,phone)
load = json.dumps(payload)
resp = Response(load, status=200, mimetype='application/json')
Account will be available if already activation, this way :
http://(HOST):(PORT)/beta/member/activation/<token>
Token will be available in the database. function can be found in module member and then send to method, like this
from openedoo.module_member import module_member
@member.route('/activation/<key>',methods=['GET'])
def activation(key):
aktivasi = json.dumps(module_member.activation(key))
resp = response(aktivasi, status=200, mimetype='application/json')
return resp
You can login with send POST method to http://(HOST):(PORT)/beta/member/login
{
"username":"USER_MEMBER",
"password":"USER_PASSWORD",
}
Login function can be found in the module auth
from openedoo.core.libs.auth import login as user_login
load_json = json.loads(request.data)
user_login(load_json['username'] ,load_json['password'])
Send POST Method to http://(HOST):(PORT)/beta/member/password
{
"user_id":"USER_ID",
"old_password":"OLD_PASSWRD",
"new_password":"NEW_PASSWORD",
"confirm_password":"CONFIRM_PASS"
}
Change password function can be found module member
from openedoo.module_member import module_member
load_json = json.loads(request.data)
edit = json.dumps(module_member.edit_password(
user_id=load_json['user_id'],
password_old=load_json['old_password'],
password_new=load_json['new_password'],
password_confirm=load_json['confirm_password']
))
resp = Response(edit, status=200, mimetype='application/json')
Only use GET method
http://(HOST):(PORT)/beta/member/logout
Logout function can be found in module auth
from openedoo.core.libs.auth import logout as user_logout
@member.route('/logout')
def logout():
log = json.dumps(user_logout())
resp = Response(log, status=200, mimetype='application/json')
return resp