5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-07 03:50:59 +08:00
wails/v3/examples/oauth/assets/index.html
Fabio Massaioli 2b9891da2c
[v3] Update and fix runtime JS API (#3295)
* Cleanup bundled runtime entry point

* Fix JS representation of Screen struct

* Expose IsFocused method in Window interface

* Update JS window API

* Fix cleanup of WML listeners

* Bundle runtime as ES module

* Update runtime dependencies

* Update runtime types and events

* Update bundled runtime

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-20 20:30:14 +11:00

42 lines
1.8 KiB
HTML

<!-- templates/index.html -->
<!doctype html>
<html>
<head>
<title>Google SignIn</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- load bulma css -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- load fontawesome -->
</head>
<body>
<div id="main" class="container">
<div class="jumbotron text-center text-success" style="padding-top:70px;">
<h1><span class="fa fa-lock"></span> Social Authentication</h1>
<p>Login or Register with:</p>
<a wml-event="github-login" class="btn btn-primary"><span class="fa fa-github" style="color: #FFF"></span> SignIn with Github</a>
</div>
</div>
<div id="details" class="text-center" style="display: none">
<image id="logo" style="width:250px"></image>
<h3 id="name" style="padding-top: 10px"></h3>
<a wml-event="github-logout" class="btn btn-primary"><span class="fa fa-github" style="color: #FFF"></span> Logout </a>
</div>
<script type="module">
import * as wails from "/wails/runtime.js";
wails.Events.On("wails:oauth:success", (event) => {
document.getElementById("main").style.display = "none";
document.getElementById("details").style.display = "block";
document.getElementById("name").innerText = event.data.Name;
document.getElementById("logo").src = event.data.AvatarURL;
document.body.style.backgroundColor = "#000";
document.body.style.color = "#FFF";
});
wails.Events.On("wails:oauth:loggedout", (event) => {
document.getElementById("details").style.display = "none";
document.getElementById("main").style.display = "block";
document.body.style.backgroundColor = "#FFF";
document.body.style.color = "#000";
});
</script>
</body>
</html>