Changes between Version 9 and Version 10 of login-service
- Timestamp:
- Jun 1, 2016, 3:30:45 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
login-service
v9 v10 60 60 #!/usr/bin/python 61 61 62 from mayfirstAuth import auth62 from mayfirstAuth import check, user 63 63 64 64 username = 'YOUR-USER-NAME' … … 66 66 appid = 'YOUR-APP-ID' 67 67 68 check = auth(username, password, appid) 68 check = check(username, password, appid) 69 user = user(username, appid) 69 70 70 71 if check == "0": 71 72 print 'Login success' 72 else 73 else: 73 74 print 'Login failure' 75 76 if user == "0": 77 print 'User exists' 78 else: 79 print 'User does not exist' 74 80 }}} 75 81 … … 77 83 '''Source:''' 78 84 85 Save this file as mayfirstAuth.py in /usr/local/lib/python2.7/dist-packages 79 86 {{{ 80 87 #!/usr/bin/python … … 85 92 url = 'https://id.mayfirst.org:8080/' 86 93 87 88 def auth(username, password, appid): 94 def check(username, password, appid): 89 95 values = {'user' : username, 90 96 'password' : password, 91 97 'app_id' : appid} 92 98 93 99 req = requests.post(url + "check", data=values) 94 100 is_valid_user = req.text … … 98 104 return "1" 99 105 100 def user(username ):106 def user(username, appid): 101 107 values = {'user' : username, 102 108 'app_id' : appid} 103 104 req = requests.post(url + user, data=values)109 110 req = requests.post(url + "user", data=values) 105 111 is_valid_user = req.text 106 112 … … 108 114 return "0" 109 115 return "1" 110 111 116 }}} 112 117 … … 116 121 <?php 117 122 123 // Fixme - only supports check not user. 118 124 function authenticate_user($user, $password, $app_id) { 119 125 $url = 'https://id.mayfirst.org:8080/check?user=' . urlencode($user) . … … 132 138 <?php 133 139 140 // Fixme - only supports check not user. 134 141 function authenticate_user($user, $password, $app_id) { 135 142 $url = 'https://id.mayfirst.org:8080/check';