Default and Alternative login URL

Re: Default and Alternative login URL

by Robert Duncan -
Number of replies: 2

Thanks Howard -  you are correct! the standard login handler will except the posted params - just create you own html page anywhere with a post action to https://moodle.example.com/login/index.php


here's an example for anyone else:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Moodle Login</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  
  <style>
    body {
  padding-top: 45px;
  padding-bottom: 40px;
}
    
    /* Set height of the grid so .sidenav can be 100% (adjust as needed) */
    .row.content {height: 450px}
    
    /* Set gray background color and 100% height */
    .sidenav {
      padding-top: 20px;
      background-color: #ffffff;
      height: 100%;
    }
    
    /* Set black background color, white text and some padding */
    footer {
      background-color: #555;
      color: white;
      padding: 15px;
    }
    
    /* On small screens, set height to 'auto' for sidenav and grid */
    @media screen and (max-width: 767px) {
      .sidenav {
        height: auto;
        padding: 15px;
      }
      .row.content {height:auto;} 
    }
  </style>
</head>
<body>

  
<div class="container-fluid text-center">    
  <div class="row content">
    <div class="col-sm-2 sidenav">
      <p><a href="#">Link</a></p>
      <p><a href="#">Link</a></p>
    </div>
    <div class="col-sm-8 text-left"> 
      <div class="container">
  <div class="jumbotron">
    <h1>Moodle Login</h1> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor</p> 
  </div>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip</p> 
</div>
  
  <form class="form-horizontal" action="https://<moodle.example.com>/login/index.php" method="post" name="form" id="form">
  <div class="form-group">
    <label class="control-label col-sm-3" for="username"><i class="fa fa-user" aria-hidden="true"></i> Username:</label>
    <div class="col-sm-6">
      <input type="text" name="username" class="form-control form-control-lg" id="username" placeholder="Enter username">
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-sm-3" for="pwd"><i class="fa fa-key" aria-hidden="true"></i> Password:</label>
    <div class="col-sm-6"> 
      <input type="password" name="password" class="form-control form-control-lg" id="pwd" placeholder="Enter password">
    </div>
  </div>
  <div class="form-group"> 
    <div class="col-sm-offset-3 col-sm-6">
      <button type="submit" value="Login" class="btn btn-primary">Submit</button>
    </div>
  </div>
</form>
    </div>
    <div class="col-sm-2 sidenav">
<img src="https://moodle.org/logo/preview-moodle-logo.png">
    </div>
  </div>
</div>
<footer class="container-fluid text-center">
  <p><i class="fa fa-copyright" aria-hidden="true"></i> Example Inc.2017</p>
</footer>
</body>
</html>


Average of ratings: Useful (2)
In reply to Robert Duncan

Re: Default and Alternative login URL

by Ken Task -
Picture of Particularly helpful Moodlers

@Robert ... just wanted to say thanks for sharing (rated useful).  Very timely as was in a discussion/cussion with an entity that wants to make their initial login screen point to a identity management system (CustomOauth2).   Needed a way to keep those that admin the moodle with the 'regular' login for times when the IDM hickups ... which it did. sad

Anyhoo your page saved some time and expense to entity.

'spirit of sharing', Ken


In reply to Ken Task

Re: Default and Alternative login URL

by Robert Duncan -

@Ken.....you are most welcome! glad to be of some assistance.


all the best.

Rob.