简体   繁体   中英

Moodle Accept Login from external site from external website

We are adding Moodle to our site (different server, different sub-domain, but same main domain, and the servers are set up to be able to communicate with each other) and what we want to have it do is:

  1. if the User accesses the main site
  2. User logs in User clicks a link to Moodle
  3. The user is automatically logged into Moodle without having to reenter their info.

i have added the html form with hidden type in my main domine as moodle post url.

Main domine:

<form class="mt-3" action="http://localhost/moodle/login/index.php" method="post" id="login">
<input id="anchor" type="hidden" name="anchor" value="">
<script>document.getElementById('anchor').value = location.hash;</script>
<input type="hidden" name="logintoken" value="xUe9G7a012vTHpvtOxAfzu84YJ046pu4">
<input type="hidden" name="loginhas" value="eda690fdf">
<div class="form-group">
    <label for="username" class="sr-only">Username / email</label>
    <input type="text" name="username" id="username" class="form-control" value="admin" placeholder="Username / email" autocomplete="username">
</div>
<div class="form-group">
    <label for="password" class="sr-only">Password</label>
    <input type="password" name="password" id="password" value="eda690fdf" class="form-control" placeholder="Password" autocomplete="current-password">
</div>
<div class="rememberpass mt-3">
    <input type="checkbox" name="rememberusername" id="rememberusername" value="1">
    <label for="rememberusername">Remember username</label>
</div>
<button type="submit" class="btn btn-primary btn-block mt-3" id="login">Log in</button>

How to accept this request in moodle ? or if you have any rolution regarding this issue plese help me out of this.

Don't know if possible with Moodle. We do it for several systems using CAS (central authentication service), where several yii2 apps login against a CAS implemented with web2py.

In the Yii side we use https://github.com/2amigos/yii2-usuario for user management and https://github.com/daxslab/yii2-cas-client for auth against the CAS.

Perhaps you need to implement a CAS on Yii and check how make that Moodle authenticates against it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM