custom login form in PHP / access Cyclos API from PHP

Any issue about Cyclos 4 scripting and Webservices

Moderators: hugo, alexandre, rmvanarkel

Post Reply
canoodle
Posts: 9
Joined: Sun Feb 04, 2018 8:33 pm

custom login form in PHP / access Cyclos API from PHP

Post by canoodle »

Hello,

thanks for cyclos

if one would like to write completely customized / own login page for cyclos in php:

https://demo.cyclos.org/api

the login form could look like this:

but: what parameters inputs are needed?

also: where to send the request? action="http://request/where/shall/u/go"

the login html could be like this:

Code: Select all



					<form class="form-signin" action="http://request/where/shall/u/go">
						<input name="action" value="login" hidden="">
						<div class="table">
							<div class="column100">
								<div class="line">
									<img class="profilepicture" src="" alt="profile Picture">
								</div>
								<div class="line">
									<div class="prop">
										usr:
									</div>
									<div class="value">
										<input id="who_username" name="username" type="username" placeholder="username" value="">
									</div>
								</div>
								<div class="line">
									<div class="prop">
										pwd:
									</div>
									<div class="value">
										<input id="who_password" name="password" type="password" placeholder="passwort" value="">
									</div>
								</div>
								<div class="line">
									<div class="prop">
										<div id="status_login" class="status_error">status:</div>
									</div>
									<div class="value">
										<div id="status" class="status">status</div>
									</div>
								</div>
							</div>
						</div>

						<div class="column100">
							<input type="submit" name="login" value="login" class="button" style="width: 100%; height: 40px;">
						</div>
					</form>

or: maybe someone can to an example?

jakob.schumann
Posts: 12
Joined: Thu Apr 23, 2020 5:37 pm

Re: custom login form in PHP / access Cyclos API from PHP

Post by jakob.schumann »

Hello!

To receive a session token that can be used to redirect the user to cyclos or use as an auth mechanism via the API you can POST to /sessions and give the following as body parameters in JSON:
user - login name/email/userid
password
remoteAddress - the IP the user used to access your PHP script, for blocking not your server but the user on failed tries
See https://demo.cyclos.org/api/#operations ... -loginUser for details.

Best regards,
JS

Post Reply